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 SqlCom
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:
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.
and that's it, inside your loop you will have access to your variables with the current values