09 March 2007

SQL 2005 Script Files and VSS

Using Microsoft Visual SourceSafe 6.x and Microsoft SQL Server Management Studio (for SQL Server 2005) is a bit of a pain for scripting database changes. One problem is if you don't save the script file as ANSI, VSS cannot use its diff feature to show you the results. It will simply say, "Binary files differ." You need to save it as ANSI, since that's all VSS 6.x supports for visual diffs.

To save your .sql files as ANSI:
  • Instead of just clicking the Save button, select File | Save As...



  • Click the little arrow on the Save button and choose Save with Encoding...
  • Select the encoding and the line options, then click OK.

Then you can check the .sql file into VSS. Subsequent edits will not require you to go through all of these dialogs to properly save the file. Management Studio will use the file's current encoding and line break settings thereafter, so you can just (thankfully) click Save.

No comments: