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.
Author |
Topic |
SQL_Deepak
Starting Member
9 Posts |
Posted - 2008-05-21 : 01:23:42
|
Hi DBA experts,I have sql server 2000 database running on two machines. How to use DTS to transfer differential data from Source database to destination database.Thanx..Deepak |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-05-21 : 01:31:33
|
Create two connection mangers for source and destination. Add a data transformation task to transfer the data from source to a staging table. Add a Execute SQL task to add only the differential data to destinationthe query used will be something like--In staging not in dest;new records so insertINSERT INTO DestinationSELECT fieldsFROM Staging sLEFT JOIN Destination dON d.PKCol=s.PKColWHERE d.PKCol IS NULL--In both staging & dest;existing records so updateUPDATE dSET d.field1=s.field1,d.field2=s.field2,....FROM Destination dINNER JOIN Staging sON s.PKCol=d.PKCol--In dest not in staging;records deleted from source so deleteDELETE dFROM Destination dLEFT JOIN Staging sON s.PKCol=d.PKColWHERE s.PKCol IS NULL |
 |
|
SQL_Deepak
Starting Member
9 Posts |
Posted - 2008-05-21 : 20:28:09
|
Hi VisakhThis is ok but my Source and destination are on different servers.Please help.Thanx...quote: Originally posted by visakh16 Create two connection mangers for source and destination. Add a data transformation task to transfer the data from source to a staging table. Add a Execute SQL task to add only the differential data to destinationthe query used will be something like--In staging not in dest;new records so insertINSERT INTO DestinationSELECT fieldsFROM Staging sLEFT JOIN Destination dON d.PKCol=s.PKColWHERE d.PKCol IS NULL--In both staging & dest;existing records so updateUPDATE dSET d.field1=s.field1,d.field2=s.field2,....FROM Destination dINNER JOIN Staging sON s.PKCol=d.PKCol--In dest not in staging;records deleted from source so deleteDELETE dFROM Destination dLEFT JOIN Staging sON s.PKCol=d.PKColWHERE s.PKCol IS NULL
Deepak |
 |
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2008-05-21 : 20:34:26
|
Thats why he saidCreate two connection mangers for source and destination. |
 |
|
|
|
|