Comparing Scripts to a Database from the Command Line
IronMike
Posts: 7
In our development process, developers make database changes in a development “sandbox†SQL server. When they feel confident that their changes are correct, they check in the script for that object to source control.
I have a nightly process which uses SC command line to compare the scripts in source control against databases on a different server. Generally, this works well. However, on occasion a careless developer will check in an object with syntax errors. When SC encounters a script that it can’t parse, it just ignores that object. The resulting synchronization script would cause that object to be deleted from the database. Obviously, this is not the behavior that we desire.
I need a way to tell SC command line to not generate a synchronization script, and return an error when a syntax error is detected.
I can’t seem to find any way to do this in the documentation.
Any suggestions would be appreciated.
Thanks,
Mike
I have a nightly process which uses SC command line to compare the scripts in source control against databases on a different server. Generally, this works well. However, on occasion a careless developer will check in an object with syntax errors. When SC encounters a script that it can’t parse, it just ignores that object. The resulting synchronization script would cause that object to be deleted from the database. Obviously, this is not the behavior that we desire.
I need a way to tell SC command line to not generate a synchronization script, and return an error when a syntax error is detected.
I can’t seem to find any way to do this in the documentation.
Any suggestions would be appreciated.
Thanks,
Mike
Comments
Sorry, about the problem that you are having, the point you make is a very valid one. At the moment this is not possible in SQL Compare 6. I will raise an issue for this, hopefully it will get into SQL Compare 6.3, however I cannot make any promises at the moment.
You could loop through all the scripts and use SQLCMD to execute each of the scripts with SET PARSEONLY ON so that the syntax is checked before you get SQL Compare to create a script. I know that this by no means perfect, but it is the best thing I can think of off the top of my head.
Regards,
Jonathan
-Project Manager
-Red Gate Software Ltd
Mike