Visual Studio for Database Developers

By torgeirhelgevold

I have started experimenting with Visual Studio for Database Developers. My testing was done using an SQLServer2005 database.

Visual Studio for Database Developers is meant to make it easier to develop and deploy your database. My first impression after a few hours of “playing” is that this application will be a great help for database developers. Not only does it offer great help in organizing your scripts in database projects, but it also offers a “compile” mechanism to validate your database objects. It will catch errors like invalid Foreign Key relationships etc…

The “compiler” will also compile all the database scripts into a deployment script, which in turn can be used to deploy the database to one or more of your testing/production environments. This script is regenerated every time the project is built. The script is incremental and will only include sql for objects that don’t already exist in the database.

Initially, it seemed a bit annoying that the generated script wasn’t directly runnable in SqlServer Management Studio, but it works really well to run it using sqlcmd. There is also the option of deploying the database through the built in “Deploy” feature, which simply runs the script against the database configured for the database project. I think this option is less practical since it requires that you have full access to the database server from your workstation. This may be ok for your development environment, but it may not be feasible when deploying to your production environment.

As most realistic projects require deployment of the database to several environments, it is important to have flexibility in generating the deployment script. It is possible to declare custom build types which can be used to tailor the generation of the script to meet the requirements of each environment. I won’t go into the details of this, but it works the same way as for regular Visual Studio projects. You can also define pre/post build events which can be used in conjunction with this.

Tags: ,

Leave a Reply