Options

2 tables, same database

balancebalance Posts: 11
edited November 28, 2006 9:41AM in SQL Toolkit Previous Versions
(I've posted this a few weeks ago, but never heard back)

Is it possible to synchronize data from 2 tables (that have the same schema) in a single DB? If so, what steps would I take?

Thanks

Comments

  • Options
    Hi,

    Very simple. What you do is open a new comparison project, and specify the two databases to be the same exact database on the left as the right. Now go into mappings, and unmap the two tables that you want to cross-compare. Then map table A to table B by selecting table A on the right and table B on the left. Now table A’s data will be compared to table B’s data in the same database.
  • Options
    Thanks Brian - here was the fix I was looking for:

    // Create the mappings between a certain table

    TableMapping tableMapping = (TableMapping)mappings.Join(db1.Tables["[dbo].[Widgets]"], db2.Tables["[dbo].[Widgets2]"]);



    // Set the custom comparison key for the table

    tableMapping.MatchingMappings.Clear();

    tableMapping.MatchingMappings.Add(tableMapping.FieldMappings["RecordID"]);

    tableMapping.RefreshMappingStatus();
Sign In or Register to comment.