This is potentially quite tricky. One table is easy, either use DTS via the import/export wizard or run an insert into query (qualifying the table with a database prefix). If you have more than one table, and there are relationships, you're in for a bit of work. I suggest scripting the source database, and creating the tables with that. Next use DTS, but transfer the tables in the correct order, being aware of referential integrity. (We actually have a VB program that will handle all this for us). Of course, if you have a lot of tables, is a backup/restore an option, or do you need to preserve data in the destination ? If that's not enough detail, please clarify your situation, and I'll expand on the relevant scenario.
If you want to transfer the entire database do the following.
1) Backup the original DB.
2) Restore the backup to the new datbase.
You can do this with Enterprise Manager. If you want to use T-SQL, read the topic "How to restore a database with a new name (Transact-SQL)" in SQL Books Online (BOL).
You can also use DTS. It should handle dependecies properly if you set the proper options. Terry L. Broadbent FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.