Skip to content

XML Column Invalid References

Problem

You have executed a script that contains database columns holding XML, and the template you are using has been defined with lookup's to resolve identifiers contained in XML and you have ended up with data in the database with these invalid identifiers that look like a hash of characters. When DATASTAR generates a script from a template where you have defined lookup's on a XML Column, the identifiers that match the XPath statements get replaced with a hashkey made up from the alternative criteria specified in the template. This allows DATASTAR to resolve these identifiers when deploying to a different environment.

Cause

You must configure the script to error when not found in the template if you want to ensure that all the identifiers are resolved. Otherwise you could find that not all the identifiers get resolved. If you have already configured the script to error on failed lookup's then make sure you are executing the scripts from within DATASTAR.

*Note: If you use SQL Server Management Studio by default each block in the scripts will be auto-committed so that if you get an error on the lookup's the table update / insert will still be applied. In this case you will end up with corrupted data if any of the lookup's failed. You should run under a single transaction and rollback if errors occur. If you execute the scripts using the DATASTAR tool-set this will happen automatically.*