如何确定SSIS数据集中的行数 [英] How to determine row count in SSIS dataset
问题描述
我经常遇到SSIS包中的一种情况,在该情况下,我运行SQL命令从ADO连接返回一组行。在某些情况下,我想根据返回的行数进行分支。 ado结果集存储在SSIS对象数据类型中。 SSIS表达式或脚本组件中是否可以获取行数?
I frequently encounter a situation in SSIS packages where I run a SQL Command to return a set of rows from an ADO connection. There are cases where I want to branch based on the number of rows returned. The ado resultset is stored in an SSIS 'object' datatype. Is there a way in SSIS expression or Script component to get that count of rows?
推荐答案
不要使用Execute Sql任务,而要使用像这样的数据流任务。
Instead of using the Execute Sql task, use a dataflow task like this.
- 使用源组件检索数据
- 使用行计数组件将行计数存储到变量中
- 使用记录集目标组件并将其存储在您的原始变量(system.object类型)中
然后返回控制流并按计划继续操作,使用rowcount变量分支控制流。
Then return to the control flow and continue as you planned, using the rowcount variable to branch your control flow.
这篇关于如何确定SSIS数据集中的行数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!