开发者

Read column values to variable in SSIS using for each loop

I want to read the resultset of a table using the following stmt:

Select col1 as A,col2 as B from tablename; 

Then, I want to read each row of the result set into local variables of the SSIS package and for each row I have to pa开发者_运维问答ss the values to the script task.

I want to use foreach loop in SSIS. I took Foreach Item Enumerator.

The question: How to read the values into the variable using the For each Item enumerator and how can i iterator can i use select count(*) from table; pass that value to a variable and asssign the count value in the foreach loop.

I'm stuck at how to assign the count value and read columns to variables. Can anyone help with these?

Thanks in advance.


I'm not exactly sure what it is that you're trying to do, but it would seem that you're trying to process data in your control flow. The foreach iterator is not made for processing data sets, it's made for iterating over multiple data sets and doing something to each of them, usually passing them to a data flow.

You might find it more useful to create a data flow. Start with a data source component that gets the data that you want and then pass the data to a Script Component to do the processing.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜