Thursday, March 8, 2012

Copy Data from one database to another

is there any query to copy data from one database to another replacing all data in the second database

There is not a single query that will move the data from one database to another. If the databases are identically constructed, you could create a script that truncated each table and then performed a Select * from matching tables in the two databases. This can be difficult if you have used identity columns and properly implemented referential integrity.

The Data import wizard (Sql 2000) and comparable tools will move make a copy of a database.

You can also use a backup and restore.

|||

Have you looked into any of the following solutions...

SQL Server Integration Services? - http://msdn.microsoft.com/sql/bi/integration/
Copy Database Wizard (will be vastly improved in SQL Server 2005 SP2) - http://msdn2.microsoft.com/en-us/library/ms188664.aspx
Backup and Restore?

Paul A. Mestemaker II
Program Manager
Microsoft SQL Server
http://blogs.msdn.com/sqlrem/

No comments:

Post a Comment