Simple Example Needed: Sync just one record from one table

Automate and integrate using the SQL comparison API

Moderator: Chris Auckland

Simple Example Needed: Sync just one record from one table

Postby CoastalData » Mon Oct 26, 2009 3:31 pm


I need a simple example... I just want to sync one record from one table. All of the examples I've looked at loop through all mappings conditionally setting the desired tables' include property to True, and all the others to False, but is that really neccessary?

Isn't there some simple way to say:

1. Include just this one table (without looping) and disregard all other tables
2. Filter to just this one record (id=172)
3. If the records exist in db1 and db2 then sync them.

If I set this up in Sql Data Compare 8, this works PERFECTLY. Why does this seem so difficult in the SDK?
Posts: 16
Joined: Thu Jun 18, 2009 9:03 pm

Postby Brian Donahue » Tue Oct 27, 2009 5:09 pm

Hi Jon,

Thanks for your question. I suppose you have two approaches that you can use -- one would be to create the mappings automatically, loop through all matching mappings, and set the "Included" property to false on all of them except the table or view that you want to compare.

The other mapping approach would be to manually construct a table mapping in code and then add it to a manually-constructed TableMappings collection.

To compare a subset of data, you can apply a "WhereClause" to the mapping to limit the data to the records that you want to compare and synchronize. There are many ways to filter the data in either the comparison or synchronization processes.
Brian Donahue
Posts: 6669
Joined: Mon Aug 23, 2004 10:48 am

Return to SQL Comparison SDK Previous Versions

Who is online

Users browsing this forum: No registered users and 0 guests