Results 1 to 2 of 2
  1. #1
    Join Date
    May 2010
    Posts
    56

    Unanswered: 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

  2. #2
    Join Date
    May 2010
    Posts
    56
    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..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •