如何记录受 SSIS 执行 SQL 任务影响的行数 [英] How to Log Number of Rows affected by SSIS Execute SQL Task
本文介绍了如何记录受 SSIS 执行 SQL 任务影响的行数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我执行像Select ..."这样的sql语句时,我只能看到...100%"已完成...
When I execute a sql statement like "Select ...", I can only see "...100%" completed...
我想记录受影响的行数.
I want to log the number of rows affected.
我们该怎么做?
推荐答案
从存储过程中运行您的 SELECT,您可以在其中将行数记录到表中,或者做任何其他事情来记录它...
run your SELECT from within a stored procedure, where you can log the rowcount into a table, or do anything else to record it...
CREATE PROCEDURE SSIS_TaskA
AS
DECLARE @Rows int
SELECT ... --your select goes here
SELECT @Rows=@@ROWCOUNT
INSERT INTO YourLogTable
(RunDate,Message)
VALUES
(GETDATE(),'Selected '+CONVERT(varchar(10),ISNULL(@Rows,0))+' rows in SSIS_TaskA')
GO
这篇关于如何记录受 SSIS 执行 SQL 任务影响的行数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文