Unanswered: Errror handling and logging in Sybase 12.5- New to Sybase
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:
Insert into ABC values ('XYZ')
if (@@error != 0)
Insert into LogTable(@@Error, 'InsertionFailed')
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.