Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to copy stored procedures from one sql server database to another 1

Status
Not open for further replies.

bigal82

IS-IT--Management
Aug 9, 2003
2
US
Greeting,

I am new to SQL server (any dbms for that matter) and I need to copy a database from one sql server to another. Asside from the acual tables how can I copy the stored proceedures and everything else. (The schema?)

Thanks
Al
 
If you don't need the information in the tables, only the database schema, then you can right click on the database in Enterprise Manger and "Script" the database. You can choose to script the whole database, or tables, triggers, stored procedures, etc... Be sure to save your script.

Then, on the second SQL Server, just run the script in Query Analyzer and it will create an exact duplicate (schema only) of what you chose to script.

Be sure to look carefully at all of the options in the script wizard when scripting the database to make sure it keeps the primary keys, etc...

OR

If you do need the data in the database, you can create a full backup of the database and restore it on the second SQL Server. I would recommend this method, even if you don't need the data, because you know it will be an exact copy of your database.

Hope this Helps!

 
Thankyou for replying Ecobb,


It worked

Thanks again
Al
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top