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.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-02-04 : 10:25:16
|
| satyajit writes "Hi I want to include error handling in my stored procedure which is running as a batch job. How we will handle all unknown errors. Presently we are using SET_xact_Abort ON option.Once we will remove this option we should handle all errors inside the procedure. How can i capture Error_Messages in SLQ server , because it throws messages in the envoirnment in which it is running.Please suggest me the best way to hanlde errors in SQL server" |
|
|
nrafiq
Starting Member
9 Posts |
Posted - 2002-02-04 : 10:30:26
|
| Hi,I don't know you know this(@@ERROR) statement. It works like this method.When Microsoft® SQL Server™ completes the execution of a Transact-SQL statement, @@ERROR is set to 0 if the statement executed successfully. If an error occurs, an error message is returned. @@ERROR returns the number of the error message until another Transact-SQL statement is executed. You can view the text associated with an @@ERROR error number in the sysmessages system table.Because @@ERROR is cleared and reset on each statement executed, check it immediately following the statement validated, or save it to a local variable that can be checked later.I think it may be useful to you.Rafi |
 |
|
|
andre
Constraint Violating Yak Guru
259 Posts |
Posted - 2002-02-04 : 10:31:33
|
| These articles will get you started:[url]http://www.sqlteam.com/item.asp?ItemID=6881[/url][url]http://www.sqlteam.com/item.asp?ItemID=2290[/url][url]http://www.sqlteam.com/item.asp?ItemID=2463[/url] |
 |
|
|
|
|
|