Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 How do copy store procedure to another SQL Server?

Author  Topic 

TAS
Yak Posting Veteran

65 Posts

Posted - 2004-02-26 : 13:22:48
I use DTS to copy database to another SQL Server, but it only copies views and tables. All store procdeures are not copied. Anyone knows how to copy store procedure?

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-02-26 : 13:24:33
If you want to copy a database to another SQL Server, use BACKUP/RESTORE or sp_detach_db/sp_attach_db to do it. Don't use the copy database wizard.

To move just stored procedures, generate the script for them on the source database by right clicking on the database in EM, go to all tasks, then to generate sql scripts. Once you have the script, run the script on the destination server.

Tara
Go to Top of Page

sphadke
Yak Posting Veteran

55 Posts

Posted - 2004-02-26 : 13:27:31
If its just one stored proc you can open the procedure select the sql code and paste it into a new procedure on your destination server or

when you open the DTS Wizard select the copy objects and data between SQL Server Databases -> next UnCheck the copy all objects then click on Select Objects and select all the tables / views / procs you want..




Sachin
Go to Top of Page

sphadke
Yak Posting Veteran

55 Posts

Posted - 2004-02-26 : 13:33:35
quote:
Originally posted by tduggan

If you want to copy a database to another SQL Server, use BACKUP/RESTORE or sp_detach_db/sp_attach_db to do it. Don't use the copy database wizard.

To move just stored procedures, generate the script for them on the source database by right clicking on the database in EM, go to all tasks, then to generate sql scripts. Once you have the script, run the script on the destination server.

Tara



thats even better.. thanks Tara


Sachin
Go to Top of Page

TAS
Yak Posting Veteran

65 Posts

Posted - 2004-02-26 : 13:47:34
I created SQL Script,but how to run it on destination server?
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-02-26 : 13:48:53
Connect to your destinatin server in Query Analyzer, open up the script, then hit F5 or the green arrow to execute it.

Tara
Go to Top of Page

sphadke
Yak Posting Veteran

55 Posts

Posted - 2004-02-26 : 13:49:48
quote:
Originally posted by TAS

I created SQL Script,but how to run it on destination server?



Open your Query Analyser and connect to your destination server. then load the script into your QA and run it.


Sachin
Go to Top of Page
   

- Advertisement -