Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Why is @@ERROR not being set in stored proc?

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-07-14 : 08:49:51
Sal28 writes "Is SQL 2000 supposed to set @@ERROR when an error with severity 11 or above is encountered? I have a stored proc that checks the error value (actually it sets a variable I created = to @@ERROR since @@ERROR resets itself on the 'IF') after each update/insert in order to do a rollback and return the value, but every time I encouter an error I am receiving a result of 0, even though the rollback is successful.
The error is a datatype conversion. It started out as a simple coding error on my part, but now I am wondering why SQL isn't sending back the right error number to my application. It's probably simple, I konw but I am new at this and have unwittingly been thrown into many things over my head here at work...
thanks in advance for help!"

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2006-07-14 : 08:55:24
can u post the code here ?


Harsh Athalye
India.
"Nothing is Impossible"
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2006-07-14 : 08:56:42
Is the set statement being executed?
Maybe the error is causing the spid to terminate so the variable never gets set.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -