简体   繁体   中英

How to create database project from existing SQL Server database?

通过使用VS TFS Database Edition 2008,如何从现有的SQL SERVER数据库创建dbproject?

在“Visual Studio”中,转到“SQL Server对象资源管理器”,找到数据库,右键单击所需的数据库,然后选择“创建新项目...”

这在VS 2010中已更新。现在可以从项目上下文菜单中选择“导入数据库对象和设置”。

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM