Click here to Skip to main content
15,886,074 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Does any one have a script that copies stored procedures from current database
to another database programmatically
create procedure move
Decalre @databasename nvarchar(255) --the database which i want to move stored
procedures to

thanks
Posted
Updated 17-Jul-20 21:35pm

you can do it in below simple steps

1. Go the server in Management Studio
2. Select the database, right click on it Go to Task.
3. Select generate scripts option under Task
4. and once its started select the desired stored procedures you want to copy
and create a file of them and then run script from that file to the DB where you want to create them.
 
Share this answer
 
Comments
King Fisher 28-Nov-14 11:49am    
enough :) 5+
Shweta N Mishra 28-Nov-14 11:51am    
thank you :)
Follow the Steps

1. Go to Store Procedure and right click and create and drop script
2. Open the Query window from other database.
3. Execute the Store procedure script
 
Share this answer
 
 
Share this answer
 
Comments
oula alsheikh 29-Nov-14 6:39am    
i wanted to rate the solution as 5 but i pressed one in a wrong way
how can i correct that?
 
Share this answer
 
COPY THE SCRIPT AND PASTE IN SELECTED DATABASE
 
Share this answer
 
Comments
CHill60 20-Jul-20 4:18am    
Far better solutions were posted over 5 years ago. Your approach only works one at a time - not much good if there are dozens of stored procedures to transfer.
By the way - remember that using all capitals is considered to be shouting in internet forums. It's rude, and will attract downvotes.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900