nimi
nimi

Reputation: 5507

How to create database project from existing SQL Server database?

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

Upvotes: 7

Views: 6606

Answers (3)

aroo
aroo

Reputation: 71

In "Visual Studio" go to the "SQL Server Object Explorer" locate to database, right-click on the database you want and select "Create New Project ..."

Upvotes: 7

user1183346
user1183346

Reputation:

This as updated in VS 2010. There is now the option to "Import database objects and settings" from the project context menu.

Upvotes: 6

marc_s
marc_s

Reputation: 755451

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....

Upvotes: 5

Related Questions