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