Copy Stored Procedures

  • How to copy stored procedures from one SQL server to another.

    When you right click on a SP in Enterprise manager you can copy the SP - how do you paste it in again???




  • 1) You can use EM to Import/Export objects between servers, choosing specific objects.

    2) You can right click in EM and choose all task then script objects and script all the SPs to a single file to execute back to the other server.

    "Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)

  • Thanks!

    I have used this tool much but I have missed the SP copy function for some reason...

    Do you know something about the "right click" Stored procedure possibility (paste it somewhare??)?



  • When you say right click stored procedure method, are you talkign about the properties screen, works like most etxt apps, just press CTRL+A to select all then right click and copy or press CTRL+C to copy which will be available to any other app for pasting via the windows clip board. So to paste it in again you can go to EM and open the node for Stored Procedures in the database and right click on the SP node or in the object side and click New Stored Procedure... which will open a new SP dialog then you CTRL+A to select the whole area and CTRL+V to paste over and apply. Or you can paste into QA and run against the database you wish to add to.

    "Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)

  • Great!

    Thanks for all Your help!



  • I think you might be referring to doing it in Query Analyzer,there you can right click anything and select "send to window" or "send to file". Faster than the copy/paste from EM, but only available in SQL2K.


  • You can use EM to generate script ( text files containing all instructions to drop and recreate the stored procedures on an other server

    Highligt one stored procedure , then with the right button and select "all tasks" and "generate sql script"

    this can also be applied to others object ( tables , views ,...)

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply