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

PhilnPhiln Posts: 11
edited April 11, 2013 8:10AM in SQL Compare Previous Versions
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

Comments

  • James BJames B Posts: 1,124 Silver 4
    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.
    Systems Software Engineer

    Redgate Software

  • 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
  • James BJames B Posts: 1,124 Silver 4
    Sure thing, do post back if you need anything further!
    Systems Software Engineer

    Redgate Software

Sign In or Register to comment.