RSS‎ > ‎

SQL :: How to get @@error and @@rowcount at the same time?

posted Sep 16, 2012, 10:01 PM by Ashish Jain
If @@Rowcount is checked after Error checking statement then it will have 0 as the value of @@Recordcount as it would have been reset. And if @@Recordcount is checked before the error-checking statement then @@Error would get reset. To get @@error and @@rowcount at the same time do both in local variable. SELECT @RC = @@ROWCOUNT, @ER = @@ERROR