Comparing Scripts to a Database from the Command Line

IronMikeIronMike Posts: 7
edited October 15, 2007 11:39AM in SQL Compare Previous Versions
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

Comments

  • Mike,

    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
    Jonathan Watts

    -Project Manager
    -Red Gate Software Ltd
  • Thanks Jonathan, I'll give that a try.

    Mike
Sign In or Register to comment.