Skip to content Skip to sidebar Skip to footer

How Can I Use A Foreach Loop Container In Ssis To Iterate Through A Multidimensional Array?

I have an SSIS package that's updating a couple tables using scripts and a foreach container among a couple other things. I'm using SqlConnection and SqlCommand to call this query

Solution 1:

ok, you actually dont have to do that way. Since your source is a t-sql query you could have ran it with an "execute sql task". But that's fine, it can be done this way too. I'm actually working on a package right now that get a result set into a datatable on a script task and loads it into a object variable, like you do with your DirectoryList.

To read the values, just configure your loop like this, where the variable is the Object variable:

enter image description here

and on the mappings tab, like this: where the variable is the package variable where you want the value of the first column (index 0) to be placed in. You can have as many indexes as you have columns on your result set.

enter image description here

and that's it, inside your loop you will have access to your variables with the current values

Post a Comment for "How Can I Use A Foreach Loop Container In Ssis To Iterate Through A Multidimensional Array?"