Automating SQL ChangeSet

keymookeymoo Posts: 38
edited December 19, 2007 10:13AM in SQL Compare Previous Versions
Hi there,

I am using SQL ChangeSet with SQL Compare 6 to manually Compare our development database against the latest source from Visual Source Safe. I'd like to be able to:

1) Automate the changes between the database and the scripts
2) Check into source safe any differences found
3) Schedule the above to run every night

I thought of three solutions:

1) Use the Red-Gate commandline tools
2) Use VBscript with the SQLCompare API
3) Write a console app in C# using SQLCompare API

Schedule any of the above with some kind of scheduler. Which is the best solution - I'm not even sure if 1) is possible.

Thanks,
keymoo

Comments

  • Unfortunately, SQL Changeset doesn't yet have a command-line version or API elements.

    If I was constructing a solution as you describe, I'd probably use a batch file with the SQL Compare command line command to do the synchronization to the working folder, and Visual Source Safe's own command line (http://msdn2.microsoft.com/en-us/library/asxkfzy4(VS.80).aspx) to deal with checking the files back in.

    If it's running at night you can probably get away with checking out all of the relevant files, running the synchronization, and then checking them all back in. Otherwise you'll need to use the SQLCompare API so that you can get the list of modified files out of the comparison in order to check out and check in the correct files (you can get the list by taking the FileName properties of the ScriptSynchronizationAction objects in the ScriptSynchronizationActions object which is a member of the Work object). I'd use C# with it, but mostly because I'm not as familiar with VB.
    Software Developer
    Redgate Software
  • Thanks I checked out the whole project, ran sqlcompare and then checked it all back in. I don't have time to check the differences, so this solution works great for me at the moment. Thanks!
Sign In or Register to comment.