How can I use a foreach loop container in SSIS to iterate through a multidimensional array?

前端 未结 1 1694
青春惊慌失措
青春惊慌失措 2021-01-27 04:00

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

相关标签:
1条回答
  • 2021-01-27 04:52

    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

    0 讨论(0)
提交回复
热议问题