Import data from one table and loop through another and extract the result using Script task

  • I have been asked to do a task which is import data from one table and loop through that data with another table and fetch the matching result using SSIS Script task or script component.

    I am very poor in script writing could anyone help me with this please?

    Table 1

    username cust_id

    a 2

    b 4

    c 5

    Table 2

    cust_id city

    2 london

    4 bngl

    Loop through table-1 data with table-2 data and fetch the O/p as following

    username cust_id

    a 2

    b 4

    Thanks in advance

  • msbi.ravindhar (12/13/2015)


    I have been asked to do a task which is import data from one table and loop through that data with another table and fetch the matching result using SSIS Script task or script component.

    I am very poor in script writing could anyone help me with this please?

    Table 1

    username cust_id

    a 2

    b 4

    c 5

    Table 2

    cust_id city

    2 london

    4 bngl

    Loop through table-1 data with table-2 data and fetch the O/p as following

    username cust_id

    a 2

    b 4

    Thanks in advance

    Looks like a simple query – no 'looping' required:

    select t1.username, t1.cust_id

    from table-1 t1

    where exists (select 1 from table-2 t2 where t2.cust_id = t1.cust_id)


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

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