By using VS TFS Dat开发者_如何学运维abase Edition 2008, how to create dbproject from an existing SQL SERVER database?
This as updated in VS 2010. There is now the option to "Import database objects and settings" from the project context menu.
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 ..."
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....
精彩评论