How can you get @@error and @@rowcount at the same time?

Answer Posted / pankaj

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

Is This Answer Correct ?    6 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the grouping functions?

700


can any body tell me how to know the password of current user in sql server

1778


Is sql server free?

675


What is the synonym of join?

686


Explain the etl (extraction, transformation, and loading)?

724






Explain what is dbcc?

779


How to grant a permission in ms sql server using "grant execute" statements?

761


How to use go command in "sqlcmd"?

853


How to backup encryption key ?

144


Write query to return all rows sql?

792


Why use “nolock” in sql server?

722


Do you know clustered and non-clustered index?

730


Does a server store data?

669


Write a sql query to sort on different column name according to the parameters passed in the function?

695


What is replace and stuff function in sql server?

735