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

Answer Posted / sachin rakshe

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 ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the database roles? : sql server security

557


How to find index size for each index on table?

583


How to get a list of columns in a view using the "sp_help" stored procedure?

568


What is a linked server in sql server?

571


Give main differences between "Truncate" and "Delete".

576






What is impersonation? What are the different impersonation options available in ssas? : sql server analysis services, ssas

550


How do I clean up sql server transaction log?

563


What is the log shipping?

580


How to transfer data from a cursor to variables with a "fetch" statement?

582


how to restart sql server in single user mode? How to start sql server in minimal configuration mode? : Sql server database administration

458


How to connect ms access to sql servers through odbc?

543


How is SQL Azure different than SQL server?

91


How to loop through the result set with @@fetch_status?

662


Explain important index characteristics?

553


What are the differences between clustered and non-clustered index?

532