Horizontal Filtering - Input parameter

elstxelstx Posts: 25
edited August 31, 2005 9:20AM in SQL Toolkit Previous Versions
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.

Comments

  • Brian DonahueBrian Donahue Posts: 6,590 New member
    Hello,

    The important bit of code is this:
    if (storetype==ResultsStoreType.Different) 
                      { 
                         if ((int) aRow.Values[tcs.Fields["CompanyID"].OrdinalInResults1]==1 || (int) aRow.Values[tcs.Fields["CompanyID"].OrdinalInResults2]==1) si.Synchronize=true; 
                      } 
                      else 
                      { 
                         if ((int) aRow.Values[tcs.Fields["CompanyID"].OrdinalInResults]==1) si.Synchronize=true; 
                      }                  //Store the bookmark to cross-reference with in the delegate.
    
    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.
  • I did replace all instances of the 1 with my parameter and synch is true:

    //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;
  • Brian DonahueBrian Donahue Posts: 6,590 New member
    Did you change the bit where you filter the tables so that only the tables with a column named CompanyID are synchronized? You should probably look for CompanyID from the example and replace that with ServerName.
  • I did that first thing, along with changing the 1 to my value. I can send you all the code it that would be beneficial.
  • Brian DonahueBrian Donahue Posts: 6,590 New member
    Hello,

    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 [email protected]?
  • Code and databases sent as you requested.
This discussion has been closed.