How to get @@ERROR and @@ROWCOUNT at the same time?

 Posted by Blessybaby on 1/6/2010 | Category: Sql Server Interview questions | Views: 3186

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 same statement and store them in local variable. SELECT @RC = @@ROWCOUNT, @ER = @@ERROR

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response