How to create a database project from an existing SQL Server database?

Using VS TFS Database Edition 2008, how to create a dbproject from an existing SQL SERVER database?

+7
sql database visual-studio-2008 sql-server-2005
source share
3 answers

There is no direct, built-in support for this, unfortunately.

You can come close to this:

  • in SQL Server Management Studio, go to Object Explorer, right-click the database you want and select Tasks> Generate Scripts
  • select all database objects you want to use script out
  • at the end, choose to generate scripts in separate files for each db object

As a result, you will get several .sql scripts in the folder of your choice, which basically represents your database.

Further:

  • create a database project in Visual Studio 2008
  • as soon as you do, add existing scripts to this project

This is a little more related to what it should be - but this is the only way I know to achieve this right now. I don't know if VS2010 will support this easier ...

+5
source share

This has been updated in VS 2010. Now there is the option "Import Database Objects and Parameters" from the project context menu.

+6
source share

In Visual Studio, go to SQL Server Object Explorer, find the database in the database, right-click the database you need and select "Create a new project ..."

+6
source share

All Articles