SQL Server: Copy Stored Procedures [duplicate]
Is there an easy way to copy all stored procedures from one database to another? I have SQL Management Studio installed.
In SQL 2005 and 2008 management: Right click on the database, choose tasks -> generate scripts. You should be able to follow the directions in the wizard from there.
In Sql 2000 you can actually just select the procedures you want to copy, ctrl+c to copy them, then paste them into a new query window for the other DB and run it.
You can script objects out with SQL Management Studio by right clicking the database name and clicking script objects(or something like that I'm not on my Windows machine right now to check). You can select to do just the stored procs and select to have all the output go to one file instead of 1 file per an object. Once you have them in one file you can run that file against your database.
Also look into Red Gate Software's tool called SQL Compare http://www.red-gate.com/products/SQL_Compare/index.htm It's not free but does have a free trial.
精彩评论