Print this page

SQL SMO

Page Under Construction

About a year ago a colleague of mine who develops in PHP approached me and asked me if there was some way to automate Sql Server to every night script out the entire database schema so that he could check it into CVS the next day. He wanted to have an audit trail of any changes that occured to the database in case he needed to roll the database back to a given date or time based on the schema of the database, not the content.

I found the question fascinating and within a few hourse had emailed him a solution. As any newby to Sql Server can tell you it is fairly easy to backup a Sql Server 2005 database, but how do you automate that process?

In this example we are going to take a look at the technologies within the .NET Framework, SQL Server, and a code versioning system called Subversion for automating the scripting of a database and checking it in on a set interval.