Compare two variables --> do something if they are not equal

  • I'm trying to develop a package that first compares the record counts of two tables. If the counts don't match, then the next step is to replace the current table with the entire contents of the source table (i.e., truncate-->insert all records).

    My current approach is to use two Execute SQL tasks that assign the record count to two variables. All works well there. But, I'm struggling with how to compare the two variables. (The tables reside on different servers, and thus, two different data connectors. A linked server is not permitted, so I am unable to perform the record count comparisons strictly in SQL.)

    I'm guessing that the Script Component would be useful in comparing the variables, but I do not know the correct syntax. (I'm an advanced T-SQL guy that is delving into SSIS).

    Thanks in advance

    --pete

  • peterzeke (7/21/2010)


    I'm trying to develop a package that first compares the record counts of two tables. If the counts don't match, then the next step is to replace the current table with the entire contents of the source table (i.e., truncate-->insert all records).

    My current approach is to use two Execute SQL tasks that assign the record count to two variables. All works well there. But, I'm struggling with how to compare the two variables. (The tables reside on different servers, and thus, two different data connectors. A linked server is not permitted, so I am unable to perform the record count comparisons strictly in SQL.)

    I'm guessing that the Script Component would be useful in comparing the variables, but I do not know the correct syntax. (I'm an advanced T-SQL guy that is delving into SSIS).

    Thanks in advance

    --pete

    You can connect the output of the third task to the fourth task(truncate and data pump). Between third and fourth you can add constraint to check the two variables and execute if they are not equal.

    [font="Arial"]BASKAR BV
    http://geekswithblogs.net/baskibv/Default.aspx
    In life, as in football, you won’t go far unless you know where the goalposts are.[/font]

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply