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 is bit data type? What's the information that can be stored inside a bit column?

516


What is sub-query in sql server?

664


How to test values returned by a subquery with the in operator?

667


List types of tables in SQL Azure?

102


What is a cache in ssrs?

110






Can we perform backup restore operation on tempdb? : sql server database administration

582


What is provisioning, billing and metering, and connection routing concepts in the service layer?

92


How to use clusters?

547


What are null values in ms sql server?

558


What is the purpose of sql profiler in sql server?

509


What are the elements of dbms?

539


what is the sql equivaent of the dataset relation object ?

1567


explain what is raid and what are different types of raid configurations? : Sql server database administration

543


What is inner join? Explain with an example?

688


How to create a dynamic cursor with the dynamic option?

547