NewApplication vs badcustomers in SSIS

  • Hi

    Can any one suggest me how to achieve below in SSIS

    I have customers name fields as Name1, Name2, Name3, Name4, Name5 in table: NewApplication

    I have again customer name fields as Name1, Name2, Name3, Name4, Name5 in table:Badcustomers Now I want to compare each field from newApplication table with each field in badcustomers table, if matching fields names is >= 3 then display records.

    Thanks,

    Venkat

  • Assuming the tables are in the same database I think you could do a query like this:

    SELECT

    NA.Name1,

    NA.Name2,

    NA.Name3,

    NA.Name4,

    NA.Name5

    FROM

    @NewApplication AS NA

    JOIN @BadCustomers AS BC

    ON (CASE WHEN NA.Name1 = BC.Name1 THEN 1

    ELSE 0

    END + CASE WHEN NA.Name2 = BC.Name2 THEN 1

    ELSE 0

    END + CASE WHEN NA.Name3 = BC.Name3 THEN 1

    ELSE 0

    END + CASE WHEN NA.Name4 = BC.Name4 THEN 1

    ELSE 0

    END + CASE WHEN NA.Name5 = BC.Name5 THEN 1

    ELSE 0

    END) >= 3

    I'm not sure how you'd do it in SSIS and I'm not sure you should if you have the 2 tables in the same database.

  • Thanks Jack,

    I will try this and let you know. Thanks for your quick replay.

    Venkat

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

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