SQL Comparison SDK 10

Help for older versions available.

These pages cover SQL Comparison SDK 10, which is not the latest version. Help for other versions is also available.

Excluding a table from a data comparison

In the commercial version of SQL Data Compare, it is possible to exclude a whole SQL Server table from a comparison. This is also possible using the SQL Comparison SDK data comparison libraries using the mapping class.

Each Data Compare mapping has a property called "Include", which you can set to true or false, depending on whether the table's data should be included in the comparison. Here is an example where a table called Widgets, which had previously been successfully mapped using the CreateMappings method, is being excluded from the data comparison:

C# Toggle source code

  1. Database db1=new Database();
  2. Database db2=new Database();
  3.  
  4. db1.RegisterForDataCompare(new ConnectionProperties(".", "WidgetDev"), Options.Default);
  5. db2.RegisterForDataCompare(new ConnectionProperties(".", "WidgetLive"), Options.Default);
  6.  
  7. // Create the mappings between the two databases
  8. TableMappings mappings = new TableMappings();
  9. mappings.CreateMappings(db1.Tables, db2.Tables);
  10. mappings["[dbo].[Widgets]"].Include=false;
  11.  
  12. ...

 

 


Didn't find what you were looking for?