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

explain different levels of normalization? : Sql server database administration

524


what are the different ways of moving data/databases between servers and databases in sql server? : Sql server database administration

513


What is the difference between writing data to mirrored drives versus raid5 drives

513


What is sql service broker?

592


How to create function without parameter in sql server?

563






How to use go command in "sqlcmd"?

646


What is store procedure? How do they work? When do you use?

515


What is thr feature of change data capture?

508


Explain the first normal form(1nf)?

561


What is the process of normalising?

592


How to disconnect from a sql server using mssql_close()?

591


What is the native system stored procedure to execute a command against all databases?

541


What is Sqlpaging in SqlServer 2005 ?

662


How to use "begin ... End" statement structures in ms sql server?

528


What are the new scripting capabilities of ssms? : sql server management studio

559