Friday, February 17, 2012

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"Andy" <andy@.shirtshackomaha.com> wrote in message
news:0JRNc.4$oA5.1@.okepread05...
> 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

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

No comments:

Post a Comment