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
Published 25 February 2013
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
- Database db1=new Database();
- Database db2=new Database();
- db1.RegisterForDataCompare(new ConnectionProperties(".", "WidgetDev"), Options.Default);
- db2.RegisterForDataCompare(new ConnectionProperties(".", "WidgetLive"), Options.Default);
- // Create the mappings between the two databases
- TableMappings mappings = new TableMappings();
- mappings.CreateMappings(db1.Tables, db2.Tables);
- mappings["[dbo].[Widgets]"].Include=false;
- ...