TableDifference and additions/deletions

Automate and integrate using the SQL comparison API

TableDifference and additions/deletions

Postby micmt » Thu Jul 19, 2012 6:50 am

Effectively after comparison we should have left rows,right rows and different rows (i.e. deletions , additions, updates )
In your code samples ( TableMappingExample.cs) you seem to show only different rows

Code: Select all
session.CompareDatabases(db1, db2, mappings);
TableDifference difference=session.TableDifferences["[dbo].WidgetPrices]"];
foreach(Row row in difference.ResultsStore)

How we can see additions and deletions ?
Posts: 1
Joined: Thu Jul 19, 2012 6:26 am

Postby Brian Donahue » Fri Jul 20, 2012 9:37 am

There are a few ways to do it... you can go through all of the rows using foreach and only print out rows that have a Type property of "In1" or "In2". You can also construct a ResultsReader that only shows "In1" or "In2" and iterate throug the results:
Code: Select all
 Reader resultsReader = session.TableDifferences["[dbo].[Widgets]"].ResultsStore.GetReader(Row.RowType.In1);
foreach (Row row in resultsReader)
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