Horizontal Filtering - Input parameter
elstx
Posts: 25
When using the example in "Implement Horizontal Filter Using SQLDataCompare" is it possible to add an additional parameter to pass in the value to compare by? I tried adding one, but it doesn't appear to work correctly. The value is being passed in correctly, but the processing doesn't seem to complete. I don't get any comparison or synchronization information and no data is changed, but I can see that it is reading the data from the tables. The output from the command line looks like:
/*
Run this script on ..SYNCH2
This script will make changes to ..SYNCH2 to make it the same as ..SYNCH1
Note that this script will carry out all DELETE commands for all tables first, t
hen all the UPDATES and then all the INSERTS
It will disable foreign key constraints at the beginning of the script, and re-e
nable them at the end
*/
SET NUMERIC_ROUNDABORT OFF
GO
SET XACT_ABORT, ANSI_PADDING, ANSI_WARNINGS, CONCAT_NULL_YIELDS_NULL, ARITHABORT
, QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
-- Pointer used for text / image updates. This might not be needed, but is decla
red here just in case
DECLARE @ptrval binary(16)
BEGIN TRANSACTION
COMMIT TRANSACTION
Press Enter.
/*
Run this script on ..SYNCH2
This script will make changes to ..SYNCH2 to make it the same as ..SYNCH1
Note that this script will carry out all DELETE commands for all tables first, t
hen all the UPDATES and then all the INSERTS
It will disable foreign key constraints at the beginning of the script, and re-e
nable them at the end
*/
SET NUMERIC_ROUNDABORT OFF
GO
SET XACT_ABORT, ANSI_PADDING, ANSI_WARNINGS, CONCAT_NULL_YIELDS_NULL, ARITHABORT
, QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
-- Pointer used for text / image updates. This might not be needed, but is decla
red here just in case
DECLARE @ptrval binary(16)
BEGIN TRANSACTION
COMMIT TRANSACTION
Press Enter.
This discussion has been closed.
Comments
The important bit of code is this:
The number 1 is the value that you're looking for, so you should replace that with the value you collect by passing in parameters, then change the column name to the one you are looking in for the value.
The point is that you should set the SyncInfo's Synchronize property to True if you want the particular row to be synchronized.
//Choose ServerName=sServerName for synchronization
if (storetype==ResultsStoreType.Different)
{
if ((string) aRow.Values[tcs.Fields["ServerName"].OrdinalInResults1] == sServerName || (string) aRow.Values[tcs.Fields["ServerName"].OrdinalInResults2]==sServerName) si.Synchronize=true;
}
else
{
if ((string) aRow.Values[tcs.Fields["ServerName"].OrdinalInResults]==sServerName) si.Synchronize=true;
Sure thing, if you can script the table schema too. I'd like some of the data from the table too, but it's no problem for me to populate it with some sample data. Can you send what you've got to support@red-gate.com?