SQL Server Database Versioning with Subversion

I found this slick little application (created by Ewout Stortenbeker) that quickly scripts DB objects to individual .sql text files as well as create one file to generate the database from scratch. This also makes it very easy to version your SQL Server database objects using a tool like SVN (Subversion).

I ran into one bug while using it. The application does not put brackets around table names when generating SQL statements for scripting data. Unfortunately one of my tables uses a MS SQL Server 2000 Reserved Keyword. Thankfully you can download the source of the application along with the executables. The line reads:

command.CommandText = string.Format("SELECT * FROM {0} ORDER BY {1}", table, orderBy);

I fixed it by adding brackets around the table reference:

command.CommandText = string.Format("SELECT * FROM [{0}] ORDER BY {1}", table, orderBy);

 

Published Monday, March 26, 2007 4:43 PM by Tod Birdsall
Filed under:

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

 

Mike Henke said:

Would you still recommend the tool? Thanks,

October 22, 2007 4:47 PM
 

Tod Birdsall said:

Yes, it works great for a free tool. I use it with MS SQL 2000. I have heard that it does not working with MS SQL 2005.

October 22, 2007 4:54 PM

Leave a Comment

(required) 
(optional)
(required) 
Submit
Picture of Tod Birdsall

Welcome!

This is the personal website of Tod Birdsall, a programmer, business analyst, and gamer. Not necessarily in that order. Learn more...

Subscribe

Be notified of my latest posts. Subscribe to my blog.