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

How you trouble shoot when any job fails

1675


What are different types of views?

700


Explain what is use of dbcc commands?

710


How can we call UDF(User Define Function) using C# code in ASP.net ?

6366


Difference between aggregate functions of sql?

836






Difference between group by clause and having clause in SQL?

740


How to create a ddl trigger using "create trigger" statements?

799


Explain the use of containers in ssis and also their types?

704


What are Row versions of DataRow?

784


What are the advantages of partitioning?

823


What is the use of attributehierarchyvisible ? : sql server analysis services, ssas

789


What have included columns when we talk about sql server indexing?

767


What do you know about normalization and de- normalization?

637


What is a table called, if it has neither cluster nor non-cluster index? What is it used for?

800


How to create new tables with "create table" statements in ms sql server?

759