将 EOF 行计数添加到平面文件目标
我有一个 SSIS 2008 包,它查询数据库,将各种数据元素连接成管道分隔的行,然后将结果输出到平面文件。这一切都很好。
但是,文件的最后一行必须是这样的:EOF|NNNNN|其中 NNNNN 是文件中存在的数据行数。
我只会输出 @@ROWCOUNT,但是查询中都包含 UNION ALL,因此 @@ROWCOUNT 返回不正确的结果。
显然,我可以使用脚本任务向 CLR 执行 shell,打开文本文件,然后以这种方式计算行数,但我宁愿避免性能损失,并将所有内容保留在 SSIS 数据流中更干净、更容易明白了。
建议?我觉得我错过了一些明显的东西。蒂亚!
I have an SSIS 2008 package that queries a database, concatenates various data elements into pipe-delimited rows, and then outputs the results to a flat file. This all works just fine.
However, the last row of the file has to be this: EOF|NNNNN| where NNNNN is the number of data rows present in the file.
I would just output @@ROWCOUNT, however the queries all have a UNION ALL in them, and so @@ROWCOUNT returns an incorrect result.
Obviously I could shell out to the CLR with a script task, open the text file, and count the rows that way, but I'd rather avoid the performance hit, and keeping it all in the SSIS data flow is cleaner, and more easily understood.
Suggestions? I feel like I'm missing something obvious. TIA!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有一个行计数任务,您应该能够在将联合行发送到目标之前使用它。
There is a Row Count Task, you should be able to use that before you send the unioned rows to the destination.