Database.CompareWith limited to specific tables?

Automate and integrate using the SQL comparison API

Database.CompareWith limited to specific tables?

Postby JoergA » Fri Jul 06, 2012 4:27 pm

Hi all:

I am evaluating SQL Comparison SDK for replicating a SQL database between remote locations. The tables to be synchronized are only about 10-20, but the database in total has some 2,000 tables. When running Database.CompareWith there seems to be no option to limit to specific tables, all the "filters" I have seen only take effect after the CompareWith has already taken place, which takes a long time for 2,000 tables even if the servers are on the same network. If I cannot limit the tables to be included in the CompareWith operation then I fear the SQL Comparison SDK will be useless for this kind of deployment...

Any clues on whether this is supported or not?


Posts: 1
Joined: Fri Jul 06, 2012 4:17 pm

Postby Brian Donahue » Mon Jul 09, 2012 1:38 pm

Thanks for your question. There is no filtering capability on Database.Register or CompareWith because a complete schema needs to be constructed and the dependency chain computed. Once that's done, you can filter which objects will be synchronized, but not before.

The same basic idea applies to comparing data as well, except you can choose which tables to compare before running the comparison.
Brian Donahue
Posts: 6590
Joined: Mon Aug 23, 2004 9:48 am

Postby StuM » Thu Sep 13, 2012 1:22 pm

I achieved this by iterating through the table mappings before the comparison. There is an Include flag you can disable to remove a table from the comparison....

Code: Select all
List<String> TablesToCompare = new List<String> { "Table1", "Table2" };
foreach (TableMapping in Mappings)
    if (TablesToCompare.Contains(Mapping.Obj1.Name))
        Mapping.Include = true;
    else Mapping.Include = false;
Posts: 5
Joined: Thu Sep 13, 2012 1:17 pm

Postby Brian Donahue » Thu Sep 13, 2012 1:59 pm

Thanks for your followup.

As far as reading the schema, you can't stop the SQL Compare engine from reading absolutely all of it before you can map tables.

For data, there are a number of different ways you can filter - For vertical filters you can exclude tables and columns using mappings. For horizontal filters, you have a few options. The WHERE clause, at least, will allow you to compare a subset of data without dumping it all back on the client first.

Please see: ... a_overview
Brian Donahue
Posts: 6590
Joined: Mon Aug 23, 2004 9:48 am

Return to SQL Comparison SDK Previous Versions

Who is online

Users browsing this forum: No registered users and 0 guests