Copy stored procedures to another database

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Andy

    Copy stored procedures to another database

    I have 2 databases, one that we use called MyShop and one that I develop on
    called TestShop.
    After I have a stored procedure working the way I want in TestShop , is
    there a way to just copy the SP to the other database without the copy and
    paste method?. Same if I have a new table. Any way to add it in without
    recreating it in the MyShop database?
    I am using Sql Server 2000

    Thanks
    Andy


  • Simon Hayes

    #2
    Re: Copy stored procedures to another database


    "Andy" <andy@shirtshac komaha.com> wrote in message
    news:0JRNc.4$oA 5.1@okepread05. ..[color=blue]
    > I have 2 databases, one that we use called MyShop and one that I develop[/color]
    on[color=blue]
    > called TestShop.
    > After I have a stored procedure working the way I want in TestShop , is
    > there a way to just copy the SP to the other database without the copy and
    > paste method?. Same if I have a new table. Any way to add it in without
    > recreating it in the MyShop database?
    > I am using Sql Server 2000
    >
    > Thanks
    > Andy
    >
    >[/color]

    If you're in Query Analyzer, just change the database name from the
    drop-down at the top of the screen and run the script again. But hopefully
    you're storing your procedure code in some sort of source control system, so
    you can take the current version from source control, and execute it against
    the other database using osql.exe for example. This is easy to automate when
    you need to deploy to multiple target databases and/or servers. The same
    applies to tables and other objects, of course.

    Simon


    Comment

    Working...