Monday, February 20, 2012

Record Synchronization

I wanna syncronize data from two sources. (say fields like First Name, Last Name, Email, TimeStamp)

I wanna syncronize their changes during last 24 hours. I check the TimeStamp for the whole record. i dont care about fields.

Whichever is the latest Updates/Creates it on other side depending upon if it exists there. The side having greater TimeStamp rules and the record is overwritten on the loosing side. Great..

The catch is if the record does not exist at other side... i wanna create a new record.

I just wanna read the records that have changed during last 24 hours at either side in two separate DataSets. I will batch update them Later. since a record was not modified/ or it did not exist it was not selected...


How im gonna know (if i read only the records that have changed during last 24 hours)

if i need to (add/ or modify) it to other side?

Rephrase: if it already exists or not on other side?

You could try delete old/insert new instead of update. If you do not have the record on the other side you will simply ignore the result of delete.|||

If the two data sources are connectable and reachable to each other you could use a linked server / cross database query to get the diff results. If not I would consider using a query to extract all the data from one source and check this one-by-one with on the second data source.it depends on the amount of data if you do the direct comparison on the server or on the client.

Jens K. Suessmeyer.

http://www.sqlserver2008.de

No comments:

Post a Comment