I am using merge replication in SQL 2012. I am trying out the TableDiff utility to show non convergence.
I see a problem with this approach though. This is because I am using parameterised filters to filter the subscriptions.
In this instance the TableDiff utility tells me that there are missing rows in the subscription and generates the SQL to insert them. If I swap the source and destination around it generates a whole lot of delete statements to remove the records at the publication.
This is not a correct result. It should just check the rows that exist at the subscriber, or understand the filters and know which rows should be at the subscriber.
Can I use this utility in this instance? If not is there an alternative? I find it surprising that none of the documentation about this utility mentions this problem.
Best Answer
Run
TableDiff.exe
against a view configured to limit the source table in the same way your replication filter does. I've created an example here:Next, we run TableDiff.exe against both tables, clearly there will be differences since we are not excluding the filtered rows (
FilterColumn = 1
)Next, we create a View that has a
WHERE
filter to select only theFilterColumn = 1
rows:Now, when we run TableDiff.exe against the view, we get the desired results. Only a single row is identified as missing from the destination table (the row we added after "replicating" the rows from the source table).