Filter rows before data compare
Rippo
Posts: 10
Hi
I need to be able to filter rows before I perform a DATA compare using the SQL toolkit.
I have read a post where an example called selectionDelegate was emailed to the user.
http://www.red-gate.com/MessageBoard/viewtopic.php?t=658&highlight=filter
Please can you send me this example or point me to a url where I can see this working?
Thanks
Richard Wilde
I need to be able to filter rows before I perform a DATA compare using the SQL toolkit.
I have read a post where an example called selectionDelegate was emailed to the user.
http://www.red-gate.com/MessageBoard/viewtopic.php?t=658&highlight=filter
Please can you send me this example or point me to a url where I can see this working?
Thanks
Richard Wilde
This discussion has been closed.
Comments
I've posted some (reasonably complex) selectiondelegate code to the Knowledge Base.
You may need to be aware, though, that the SelectionDelegate merely acts as a filter to the rows of data that will be synchroinized. It does not actually stop the data from being compared in the first place. All of the data must be compared first.
Here is a link to the code:
http://www.red-gate.com/messageboard/vi ... php?t=1067
One more thing would really help me is that I need to only perform this on certain tables
Please can you aid me in intregrating this into your example?
I have the code to this
foreach (TableDifference difference in obComparisonSession.TableDifferences)
{
if (difference.Name.ToLower() == "[dbo].[links]")
{
difference.Selected = true;
}
else
{
difference.Selected = false;
}
}
Does this go before
RedGate.SQL.Shared.ExecutionBlock obExeBlock = obSqlProvider1.GetMigrationSQL(obComparisonSession, IncludeRowDelegate, false);
Also I need to perform the comparison on an unkown quantity of record ID's within a single table. Can you offer some advice on how I would do this.
I look forward to your reply.
Many thanks
Richard
In the example, this is the bit that chooses which tables will be selected for comparison: I would imagine that you should change this a bit: