amateur
amateur

Reputation: 44605

pull stored procedures from sql server to database project

I have a sql server database which has a number of stored procedures. I would like to add these stored procedures to TFS source control in to database project.

It would be a difficult and time consuming task to copy all these over one by one. Is there any automated way or tool that pulls all stored procedures from a database and adds to visual studio database project?

Upvotes: 3

Views: 3594

Answers (3)

satish
satish

Reputation: 61

We can resolve this by using Visual Studio 2012. Follow the below steps to resolve this --

  1. In VS 2012 add the SQLServerDatabase Project.
  2. Right Click on DatabaseProject and Select Import.
  3. Import the corresponding Database in to the SQL Server Database Project.
  4. Whenever we do the changes in the SQL Server Database right click on the VS SQLServerDatabase Project and Select Schema Compare.
  5. Follow the Wizard.
  6. If user has created/edited the Table or SP or View then the Schema Copare will show the chages.
  7. Swap the Source and Target and Select the appropriate action in the Schema Compare.

Upvotes: 0

wilsjd
wilsjd

Reputation: 2258

It will depend on the version of SQL Server and Visual Studio, but assuming SQL Server 2012 and Visual Studio Premium 2012 or higher

If you have a database project in Visual Studio, you should be able to do a schema compare to the database and pull in all of the objects from the database including stored procedures.

There are some others who have asked similar questions.
For example: http://forums.asp.net/t/1847000.aspx/1 which links to http://msdn.microsoft.com/en-us/data/hh297028 for a SSDT guide.

Upvotes: 2

RBarryYoung
RBarryYoung

Reputation: 56735

In SSMS (Management Studio), right-click on the database icon in the Explorer Pane, click "Tasks..." and then "Generate Scripts".

Upvotes: 1

Related Questions