Copy Stored Procedures

  • Hi all,

    my team have decided to create a new DB and we want to use a lot of the sprocs from

    another DB for this new one. Both BDs are on the same server but we cannot locate a wizrd that will allow us to pick and choose what Sprocs we want to copy from one DB to the other.

    Tried searching for a thread with 'Copy Stored Procedures' but no joy, thought it might have been a common task?

    Thanks in advance,

    Mitch...

  • Hi,

    SQL Server does have a native wizard for generating object scripts.

    In the Object Explorer view in SSMS.

    Follow the steps below:

    1. Right click on the db which has the stored procedures you need to copy.

    2. Select TASKS

    3. Click GENERATE SCRIPTS...

    Follow the wizard, by selecting Stored Procedures and nothing else.

    Once the wizard is finished you can use the script produced against any other database.

    Hope this helps

  • Why don't you just recompile them on the new database from your source control system?

    CEWII

  • Not to be too pedantic but thats assuming they use a sourcesafe solution :hehe:

  • Cheers Lewis, that was spot on !!

    Thanks again,

    Mitch...

  • Lewis Dowson (11/4/2009)


    Not to be too pedantic but thats assuming they use a sourcesafe solution :hehe:

    I agree, but I wanted to make a point without being unpleasant about it. and I wasn't saying SourceSafe, but Vault, SVN, TFS, and CC as well.

    If you don't have ANY source control system then you have other problems you need to deal with.

    When you mention developerS you should have some source control in place if for no other reason to maintain sanity.. Source control should be the code of record, not whatever you happen to have compiled into the database right now.

    CEWII

Viewing 6 posts - 1 through 5 (of 5 total)

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