What are the challenges you face when working across database platforms? Take the survey

Database.CompareWith limited to specific tables?

JoergAJoergA Posts: 2
edited September 13, 2012 9:59AM in SQL Comparison SDK Previous Versions
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?




  • Options
    Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    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.
  • Options
    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....
    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;
  • Options
    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:
    http://sdk.red-gate.com/index.php/Filte ... a_overview
Sign In or Register to comment.