There is nothing really adequate on the market to manage version control of your SQL Server tables, views, stored procedures and tables. A few years ago I wrote a little VB6 app that allows you to compare SQL Server objects with scripts in VSS (as well as perform basic checkin/checkout functionality). I still find it useful, so I decided to post it in case anyone else can make use of it. You can download a copy of the VB6 exe here. In order to view the differences between files, it also requires a DiffMergeCtl.ocx that is installed as part of Visual Interdev 6.0 (and possibly other things) Below are a few general instructions:
- Open up SourceSafe and create a folder structure to hold the scripts for you SQL Server objects. Something like this:

- Open up the Compare Tool application and choose the “Compare SQL Server Version With SourceSafe Version“ button. Then connect to your SQL Server and your VSS database.
- Click the Tables folder in the lower pane that you created in VSS, then click on the Tables folder in SQL Server in the upper pane.
- Right click on any item in the list view at the right and chose “Add Folder To SourceSafe“ to check in all the tables in the database to VSS. Repeat the process for View, Functions and Stored Procedures

- After making a change to a stored procedure in Query Analyzer or other editor, start up the compare tool and navigate the top and bottom panes to the appropriate folder (views, tables, etc)
- Choose the “Compare Folder“ button. You should get results similar to this...

- If you choose “Show Diff“ you should get a screen similar to this:

- If you want to check in the version that is in SQL Server to VSS choose the “Add to VSS“ button. This will generate a script and check it into VSS.
posted on Wednesday, October 06, 2004 8:54 PM