@@RowCount
will provide you with the number of records affected by the SQL query.
@@RowCount
only works with immediate release. Therefore, if you are trap errors, you need to do this on one line. If you split it, you will skip the one you put second.
SELECT @NumRowsChanged = @@ROWCOUNT, @ErrorCode = @@ERROR
If you have multiple statements, you will need to record the number of lines affected for each and add them.
SELECT @NumRowsChanged = @NumRowsChanged + @@ROWCOUNT, @ErrorCode = @@ERROR
Raj More Jul 29 '09 at 17:51 2009-07-29 17:51
source share