在SSIS中,如何获取源应该被处理的行数 [英] In SSIS, how do I get the number of rows returned from the Source that SHOULD be processed
问题描述
我正在开发一个项目来添加日志记录到我们的SSIS包中。我通过实现一些事件处理程序来做自己的自定义日志记录。我已经实现了OnInformation事件,将时间,源名称和消息写入日志文件。当数据从一个表移动到另一个表时,OnInformation事件将给我一个消息,例如:
组件TABLENAME(1) 写了87行。
如果其中一个行失败,并且说只有85行被处理出来, 87.我会假设上面的一行将读取写入85行
。如何跟踪在这种情况下应该处理多少行?我想看到像写入85行中的第85行
基本上,我想我需要知道如何获取源查询返回的行数,是否有一个简单的方法? p>
谢谢
您可以使用数据源之后的行计数转换信息
,并将其保存为变量,这将是要处理的行数,一旦加载到目标位置,您应该使用在
并使用中执行SQL任务
控制流程从<< DestinationTable>>
中选择计数(*),并将计数保存到其他变量中[您应该使用查询中的Where子句来识别当前的加载]。所以你将有数字处理进行记录。
希望这有帮助!
I am working on a project to add logging to our SSIS packages. I am doing my own custom logging by implementing some of the event handlers. I have implemented the OnInformation event to write the time, source name, and message to the log file. When data is moved from one table to another, the OnInformation event will give me a message such as:
component "TABLENAME" (1)" wrote 87 rows.
In the event that one of the rows fails, and lets say only 85 rows were processed out of the expected 87. I would assume that the above line would read wrote 85 rows
. How do I track how many rows SHOULD HAVE processed in this case? I would like to see something like wrote 85 of 87 rows
. Basically, I think I need to know how to get the number of rows returned from the Source's query. Is there an easy way to do this?
Thank you
You can use the Row Count transaformation
after the Data source and save it the variable. This is going to be number of rows to be processed. Once it got loaded into the Destination, you should use the Execute SQL Task
in Control flow
and use Select Count(*) from <<DestinationTable>>
and save the count into the Other variable[You should use the Where clause in your query to identify the current load]. So you will have number rows processed for logging.
Hope this helps!
这篇关于在SSIS中,如何获取源应该被处理的行数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!