Requiem to the VS 2003/2005/2008 Database Project
Sometimes a tool comes along that is so demure yet so useful and easy to use, it is very hard to say good-bye. But our easy breezy Database project from Visual Studio 2003, Visual Studio 2005, and Visual Studio 2008 is now gone. It was replaced with a new young tool that is more full-featured, more complex, and somewhat aloof: the new Database project in VS 2010.
Several up-coming posts will detail the new tool. This post celebrates the life and times of the old tool, paying our last respects.
If you are not familiar with the old Database project, it was a Visual Studio project type that you could add to any solution. Here is the dialog in VS 2008. (It looks similar in VS 2005 and VS 2003.)
After clicking OK, you could define the connection associated with the Database project.
You could select one of the connections defined in the Server Explorer, or click Add New Reference to define a new connection.
The purpose of the Database project was simply to hold your database scripts. You could easily add any database script to this project, such as a create table script or stored procedure script. You could then check these scripts into a source code control system along with the other source code in your solution.
Once you added a Database project to your solution, the Server Explorer got additional options:
You could right-click on a table, stored procedure, or any scriptable object in Server Explorer, select Generate Create Script to Project, and the script for the selected object was automatically added to the Database project in your solution.
The Database project shown below has both a Customer table script and a CustomerRetrieveAll stored procedure script.
Once you had the scripts in your project, you could create new scripts or edit existing scripts like any other code files. This feature was especially useful for creating and editing stored procedure scripts.
Then you could select one or more scripts in Solution Explorer, right-click, and select Run to run the scripts against the database defined as the default under the Database References.
So in just a click or two in Server Explorer you could generate the script for any database object to your project. You could then work with the scripts like any other solution file. And with just a click or two on the Database project files in Solution Explorer, you could apply the scripts back to the database.
Simple and effective. Unintimidating and useful. You will be missed.