使用 for 每个循环将列值读取到 SSIS 中的变量
我想使用以下 stmt 读取表的结果集:
Select col1 as A,col2 as B from tablename;
然后,我想将结果集的每一行读入 SSIS 包的局部变量中,并且对于每一行,我必须将值传递给脚本任务。
我想在 SSIS 中使用 foreach
循环。我使用了 Foreach Item Enumerator。
问题:如何使用 For every Item 枚举器将值读入变量以及迭代器如何使用 select count(*) from table
;将该值传递给变量并在 foreach 循环中分配计数值。
我陷入了如何分配计数值并将列读取到变量的困境。任何人都可以帮忙解决这些问题吗?
提前致谢。
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 pass 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不太确定您想要做什么,但似乎您正在尝试处理控制流中的数据。 foreach 迭代器不是为了处理数据集而设计的,它是为了迭代多个数据集并对每个数据集执行某些操作(通常将它们传递到数据流)而设计的。
您可能会发现创建数据流更有用。从获取所需数据的数据源组件开始,然后将数据传递给脚本组件进行处理。
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.