Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Other SQL Server Topics (2005)
 Copying Data DB1 to DB2 Database with all tables

Author  Topic 

pankaj.pareek@sparrowi.co
Starting Member

26 Posts

Posted - 2008-07-28 : 01:24:02
Dear All,

We need to copy the all database table with data to DB1 to DB2 on daily basis. How to do that in sqlserver 2005 database without data repetations of data.

pls help me.

Thanks
Rishi Kumar Sharma

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2008-07-28 : 22:27:47
insert into db1..table select * from db2..table where ...
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-07-29 : 19:09:00
Better to do Backup/restore if you are doing for all tables.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-07-29 : 19:12:21
If you are going to use rmiao's solution, then you'll need to add a bit more code to handle duplicate data or changed data. You could use NOT EXISTS and then OUTER JOINs.

But I'd go with BACKUP/RESTORE like sodeep mentioned. It clones a database.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -