I'm trying to get the rows affected output from an sql server stored procedure activity in azure data factory to azure log analytics. I can currently get the rowsCopied and rowsRead from the copy activity. Would appreciate any help.
Asked
Active
Viewed 160 times
-1

Adeleke Abimbola
- 1
- 3
-
Have a look on this https://stackoverflow.com/questions/1103260/return-number-of-rows-affected-by-update-statements – SaiSakethGuduru Oct 11 '21 at 10:53
1 Answers
-1
Below is the sample code in determining the effected rows from stored procedure in SQL server
CREATE PROCEDURE UpdateTables
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
DECLARE @RowCount1 INTEGER
DECLARE @RowCount2 INTEGER
DECLARE @RowCount3 INTEGER
DECLARE @RowCount4 INTEGER
UPDATE Table1 Set Column = 0 WHERE Column IS NULL
SELECT @RowCount1 = @@ROWCOUNT
UPDATE Table2 Set Column = 0 WHERE Column IS NULL
SELECT @RowCount2 = @@ROWCOUNT
UPDATE Table3 Set Column = 0 WHERE Column IS NULL
SELECT @RowCount3 = @@ROWCOUNT
UPDATE Table4 Set Column = 0 WHERE Column IS NULL
SELECT @RowCount4 = @@ROWCOUNT
SELECT @RowCount1 AS Table1, @RowCount2 AS Table2, @RowCount3 AS Table3, @RowCount4 AS Table4
END
Go through this SO for complete details

SaiSakethGuduru
- 2,218
- 1
- 5
- 15