Database project connect to database instance - how to manage a subset of the actual database in the project

StackOverflow https://stackoverflow.com/questions/23397397

문제

We have an existing SQL Server database, and I'd like to create a Visual Studio database project for it and put some of the scripts for the stored procedures in that database in source control. So, I thought I would create a new database project. Is there a way I can wire up this database project to the database? I thought it might be "Add Database Reference", but that only gives me options to use some other database project in the current solution, not set up the current project to be connected to an actual database.

Ideally, I'd like to be able to right-click on my project and do a "Publish" and have all my database info prefilled. I realize that I might be thinking of this wrong, but searching around on the web is of little help. It is surprising how poorly these concepts are documented.

EDIT: After the first answer, maybe my question really is: How can I have only a part of a database managed in a database project? I had assumed this was an ordinary thing that people did all the time with database projects, but maybe not. In my case, I would like to have only some of the stored procedures in source control.

도움이 되었습니까?

해결책

After further reasearch, it seems the answer is, "no, there is no way" to have only a part of a database managed in a database project.

다른 팁

I'm using vs 2013 but i think this is valid back VS 2008

  1. Right click database project.
  2. Then choose -> import -> database.
  3. Setup a connection to your target database.
  4. When you import select the import setting Folder structure Schema\Object type
  5. And run the wizard.

This builds a folder structure containing sql script for your schema objects. Alternatively if you have sql data tools you could run the schema compare against a blank project.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top