Articles in categories

Articles

Copy Stored Procedures between databases

Ever need to copy Stored Procedures, Views or other objects from one database to another?
Here's how to do it.

  1. Rightclick the database and select Tasks --> Generate scripts
    db_copy_sp_1.jpg
  2. A wizard will open.
    db_copy_sp_2.jpg
  3. Select the objects, in my case Stored Procedures, you want to copy.
    db_copy_sp_3.jpg
  4. Specify how scripts should be saved or published.
    db_copy_sp_4.jpg
  5. Run the script.
    db_copy_sp_5.jpg

Keep in mind that when the copy script is created a USE keyword is used. You need to remove it or change it to the correct database.