Sunday, March 25, 2012

Copy DB tables and stored procedures to a new DB with different name

Hello all!

What I need to do is take a site that I have and make 3 copies of it so I will have 4 separate sites with 4 separate DB's but running on the same server. One of the sites is complete but what I need to know is how do I make a complete copy of the DB including all stored procedures and populate a blank DB that has a different name with contents from the master DB?

So if DB1 is complete and I want to now populate DB2, DB3 and DB4 with everything from DB1 (tables, stored procedures, data etc.) what would be the best way to do this?

The new sites are already setup in IIS and I have already transferred the files to each sites root, so all that is left is to setup the new DB's. They are all running on the same server… I think that is about everything someone would need to know to help me!

Any help would be greatly appreciated!!!

Hello,

1) Create empty dbs

db2,3,4

2) Right click on db1 and select Generate SQL script

3) Generate the script for tables,sp,views....

4) Open your query analyzer

Now, you have to do the following for each db

Use db2
-paste the sql script you did generate in step 3

Run it

Repeat step 4 for all your db.

Hope that helps
Regards

|||

That is easy use the Backup and Restore wizard use the restore from device option it will ask you for a new name just add the name and you will be done in a few minutes. Known issues orphaned permissions just delete the restore and create a new one. If you have more questions post again. Hope this helps.

|||

Hello

Is there another way so I can copy tables and procedures to a new DB , without any manual thing "by coding??"

Thank you

sqlsql

No comments:

Post a Comment