How to store multiple row values to different variables-SSIS

  • Hi,

    My query and result is as shown below.

    Query:Select Column1 from tableA

    Result:

    Column1

    a

    b

    c

    my requirement is i need to store result in different variable in SSIS

    like @varA -should hold result 'a'

    @varB-should hold result 'b'

    @varC-should hold result 'c'

    how can i achieve this in SSIS by using Execute SQL task?

  • I don't think you can do this in a single Execute SQL task, but you could you an Execute SQL task with Result set to 'Full Result Set' and store the full result set in a variable of type 'object'. You could then use a For Each Loop container to iterate through the object variable and have another Execute SQL task (or whatever task is appropriate for the action you want to perform) inside the For Each Loop.

    The first time through the loop, the object variable would contain 'a', the second time 'b' and the third time 'c'.

    Regards

    Lempster

  • Ya thats correct!

    But i did not want to loop as it adds more tasks to the pkg.

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

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