• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 215
  • Last Modified:

Copying Stored Procedure Using SSMS

Using SSMS, is there a GUI method for copying a stored procedure from one DB to another DB (both on the same SQL Server instance)?  in other words, not using SQL code "Create stored procedure ..."
0
eeyo
Asked:
eeyo
  • 2
  • 2
  • 2
2 Solutions
 
Éric MoreauSenior .Net ConsultantCommented:
no there isn't. You need to create the script and run it from the other database.
0
 
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
Not that I'm aware of, but just out of curiosity explain why you wish to do this via a GUI?

For a single SP, just script it out, change the database name, and re-execute.   Right-click > Script Stored Procedure As ... > Create To > New Query Editor Window.

For every SP in a database, open SQL Server Data Tools (2012 or greater), create a new SQL Server database project, and by using SQL menu > Schema Compare > New Schema Comparison... it is possible to point to two different databases, and execute all of the first database's objects, including SP's, into the second database.  Damn handy.
0
 
eeyoAuthor Commented:
Not that I'm aware of, but just out of curiosity explain why you wish to do this via a GUI?
I do it with scripting as you have suggested, but there is a client (with little SQL experience) who wants to copy the  stored procedures themselves.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
Understand, but we believe that Microsoft does not expose that functionality via a GUI, so Éric and I will declare dibs on 'You can't do that' as the correct answer here.

Also, not sure how sustainable 'want to copy the stored procedures themselves (via a GUI)' is, as almost all SQL Server developer and DBA classes in the last couple of years heavily emphasize scripting out T-SQL as opposed to using the GUI.   Reproduceble, schedulable, there's a host of reasons...
0
 
Éric MoreauSenior .Net ConsultantCommented:
>>but there is a client (with little SQL experience) who wants to copy the  stored procedures themselves.

if they are not good enough to script procedures, I wouldn't open that kind of modification to them. they can really scrap the database
0
 
eeyoAuthor Commented:
I agree with all of the above.  I just wanted to make sure there wasn't a feature is SSMS that I had been missing all these years.  Thanks.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

  • 2
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now