@@ERROR - variable shows
the error number of the last T-SQL error
@@ROWCOUNT- variable gives the number of
rows affected by the most recent SQL statements.
If @@ROWCOUNT is
checked after @@ERROR checking statement then it will
have 0 as the value of @@ROWCOUNT as
it would have been reset.
if @@ROWCOUNT is
checked before the error-checking statement then @@ERROR
would get reset.
Both run at same time and store them in local
variable
DECLARE @RC INT
DECLARE @ER INT
SELECT @RC =@@ROWCOUNT, @ER = @@ERROR
SELECT @RC,@ER
Comments
Post a Comment