If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Sybase > Errror handling and logging in Sybase 12.5- New to Sybase

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-04-11, 06:57
sudhirc212 sudhirc212 is offline
Registered User
 
Join Date: May 2010
Posts: 52
Errror handling and logging in Sybase 12.5- New to Sybase

Hi All,

I am new to Sybase.
While trying to implement Error Handling and Logging, I do the following after every Insert statement. I have created a log table LogTable with 2 fields errornumber and errormessage:

e.g.
Insert into ABC values ('XYZ')
if (@@error != 0)
begin
Insert into LogTable(@@Error, 'InsertionFailed')
commit
return
end


Now the problem is that in the log table
@@Error value i.e. the error number is not stored.
Only Error message i.e. 'InsertionFailed' is stored.
Please help with this. How can I store the Error Number in my log table.

Also is there a better way where I can store the System Generarted Error Message as well e.g. if Error code is 23000, I should get to know that it's for Unique Constraint Failure that can be stored in the logTable.

Regards,
Sid
Reply With Quote
  #2 (permalink)  
Old 10-05-11, 03:20
sudhirc212 sudhirc212 is offline
Registered User
 
Join Date: May 2010
Posts: 52
Hi.

In simple words I want to store @@Error e.g. 23000 along with the error message in a log table.
How to do this in Sybase.
Please help me with this.

Regards..
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On