What are the challenges you face when working across database platforms? Take the survey

How to make generated static data script rerunnable?

cpowercpower Posts: 1 New member
SQL Compare V14.5.1.18536

We are using the CLI with /Include:StaticData to generate script for static data changes.  The CLI successfully generated one UPDATE statement and one INSERT INTO statement, as was expected based on the change history of the static data file.  However, the script is not rerunnable because the INSERT INTO will generate a primary key violation, if executed a second time after either failure or success.

Is there a CLI command switch/option that will generate code to check for the primary key's existence before executing the INSERT INTO?  I didn't see any, and I do not want to edit the script to add it manually.

Should I truncate the static data table in the PreScript.sql?  This is not optimal, since this is one more thing that we'll forget to do.  If I truncate all our static data tables in PreScript.sql, all the rows will have to be re-inserted every release, and we won't be able to see what changed. 

Thank you for your help.

Sign In or Register to comment.