Lowell (10/12/2010)
GilaMonster (10/12/2010)
It's more general than that. It's just about every statement.
SELECT * FROM master.sys.objects -- 74 rows
IF (1=1)
SELECT @@ROWCOUNT AS RowsAffected -- 0, because the IF did not affect any rows
wow i did not know that even an IF statement affects it! thanks once again Gail!
I found that out after using this construct and getting really, really confused...
Insert <stuff>
IF @@Error = 0
SET @RowCount = @@RowCount
ELSE
GOTO ErrorHandler
@@Error behaves the same way.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability