Sunday, February 19, 2012

Copy Tables in SQL 2k5 - Need Help

I have a database - we can call it DatabaseX and I want to copy the tables, keys and indexes to DatabaseY. I tried doing and export/import and it worked for the data but the identity settings were lost. How can I maintain the integrity of the tables and copy the data at the same time?

The Copy Database Wizard is an option when Service Pack 2 is released. Currently Service Pack 2 is available as a CTP http://www.microsoft.com/sql/ctp.mspx|||

simple way is to follow conventional Backup/Resotre method... if it is on the same machine there is no issue.. otherwise u may need to transfer the logins also....

Refer

http://www.microsoft.com/technet/prodtechnol/sql/2000/maintain/sqlbackuprest.mspx

also in BOL Backup database /restore database

Madhu

|||

If you want to copy objects into database X which already exists and has objects you can use bcp with the -E switch to keep identity values.

See SQL Server 2005 Books Online topic:
bcp Utility
http://msdn2.microsoft.com/en-US/library/ms162802.aspx

You can also use the SSIS Transfer Objects task.

No comments:

Post a Comment