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
 Transact-SQL (2000)
 Get error message by sql transact

Author  Topic 

aika
Starting Member

1 Post

Posted - 2006-11-13 : 11:23:50
Hi, I'm working with Sql server 2000; I'm writing a store procedure where I have some transactions and I need to get the error message and insert it into an error table. Is there any way to get the error message by sql statements.

Thanks for any help someone can bring me.

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2006-11-13 : 11:31:24
You can add user-defined messages to sysmessages table and use RAISERROR() to raise the error at appropriate places. But if you are talking about capturing system errors the way we get using @@ERROR, then it's not possible as far as I know.

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

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2006-11-13 : 11:37:18
it depends on the severity of the error.
you won't be able to capture batch terminating error in the way you can insert it into a table.
others you can.

SQL server 2005 has much better error handling with try catch blocks. so if you can upgrade to it, do it



Go with the flow & have fun! Else fight the flow
blog thingie: http://weblogs.sqlteam.com/mladenp
Go to Top of Page
   

- Advertisement -