How to create database project from existing SQL Server database?
database, sql, sql-server-2005, visual-studio-2008
Solution
There no direct, built-in support to do that, unfortunately.
You can get close by doing this:
- in SQL Server Management Studio, go to the Object Explorer, right-click on the database you want, and pick Tasks > Generate Scripts
- select all the database objects you want to script out
- at the end, choose to generate the scripts into separate files for each db object
What you end up with are a number of .sql scripts in a folder of your choice, which basically represent your database.
Next:
- create a Database Project in Visual Studio 2008
- once you've done that, add the existing scripts to that project
It's a bit more involved that it should be - but that's the only way that I know of to achieve this right now. Don't know if VS2010 will support this in an easier way....
Problem
By using VS TFS Database Edition 2008, how to create dbproject from an existing SQL SERVER database?