Monday, November 10, 2008

Script your SQL Server database

One thing that I found that the SQL Server Management Studio always lacked was an easy way to script a database. Basically I wanted it to able to do the following things:

  • Generate SQL scripts for the DB Schema
  • Generate Insert statements for the data
  • Generating the schema was doable using the Script Wizard. Scripting the data in the form of INSERT INTO statements can't be done very easily (as far as I know).

    Previously I have always been using SQL Scripter for this, but since a while this isn't free anymore (though 79€ isn't that much money).

    A colleague pointed me to an open source project at Codeplex named SQL Server Hosting Toolkit and this exactly fits my needs.

    It is a very simple tool which makes it possible to script your database (including data) through:

    • Graphical interface
    • Command line
    • Visual Studio 2005 plugin

    The command line option makes it an excellent tool to use it in a continuous integration build or automatic deployment process.

    P.S. I know that Red Gate Software has some interesting tools that might do all this as well, but I must confess that I haven't tried those yet.. (and those aren't free either :-])

    0 comments: