How to data sync heap tables (table w/o any pri/index keys)

Compares and synchronizes SQL Server databases, backups and scripts.

Moderators: JonathanWatts, Chris Auckland, David Atkinson, eddie davis, Anu Deshpande, Michelle Taylor, alice.easey, james.billings, chengvoon.tong

How to data sync heap tables (table w/o any pri/index keys)

Postby Philn » Mon Apr 01, 2013 9:34 pm

Hi,
I need to sync tables that has no primary/index key using SQL Data Compare SDK. Is this possible in SDK?
Thanks in advance.
philn
Philn
 
Posts: 7
Joined: Fri Feb 01, 2013 11:53 pm

Postby james.billings » Thu Apr 04, 2013 3:47 pm

Hi there, thanks for posting.

If the tables in question don't have any kind of key or unique index on them, you need to specify one (our engine needs to have *something* to compare on, else it doesn't know what should match up and what shouldn't).

Assuming you can determine a column (or combination of columns) that will uniquely identify rows in some way, then you can tell the tool to use this. In the GUI, it's a case of selecting the columns by going to the Tables & Views tab, then clicking in the first column for the given table.
In the SDK, you can do the same thing through the \"MatchingMappings\" collection. Have a look at the \"TableMappingExample\" in the SQLDataCompareSnippets example that's installed with the SDK for example usage.
james.billings
 
Posts: 1144
Joined: Wed Jun 16, 2010 11:10 am
Location: My desk.

Postby Philn » Thu Apr 11, 2013 12:06 am

Hi James,
Thanks for the suggestions, I tried your suggestions - have not get it working yet, but will let you know the result.
Also I was able to work around this problem using MERGE statement, but it's mean I am not using the SDK. :-(
Thanks for your help James
philn
Philn
 
Posts: 7
Joined: Fri Feb 01, 2013 11:53 pm

Postby james.billings » Thu Apr 11, 2013 1:10 pm

Sure thing, do post back if you need anything further!
james.billings
 
Posts: 1144
Joined: Wed Jun 16, 2010 11:10 am
Location: My desk.


Return to SQL Compare 10

Who is online

Users browsing this forum: No registered users and 0 guests