Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2003

    Unanswered: Trapping Convert function error (Urgent)

    I am using a convert function to convert a character field data (which contains digits or numeric data) into integer. Now sometimes the data in that character field contains characters also, due to which my statement aborts. I am not able to trap this error into @@error global variable also.


    convert(int, '777')
    convert(int, 'a22') - want to trap this


  2. #2
    Join Date
    Feb 2004

    We cannot handle this error in stored procedure. See the following posted details
    From within TSQL, there is no way to get at the error message itself (i.e you cannot tell what the
    substituted table names were). An Open Client client can parse the error message string.

    You may be able to figure out what the substituted information was from your context, i.e. if you
    do an insert into mytable and get this error, well, you know which table you were just inserting into.

    There are a couple long-open feature requesst at Sybase, CRs 58371 and 31148, for this ability.
    You can improve the chances they might be acted upon by promoting them through the feature request
    ranking system at the International Sybase User's Group website (

    CR 31148: Wants the ability to access error message text (master..sysmessages) from a previous raise error command. Perferably as a global variable.

    CR 58371: Would like a way to get error message paramters from within TSQL. Example: 1105 occurs, can get 1105 from @@error, but would like to get the dbname parameter.

    It would be useful to have a new global variable @@errormsg with gives the
    error msg related to @@error

    i know msg can be selected fom sysmessages, but that does not give
    the exact msg as arguments in that are missing

    The way a client app gets the eroor msg , to get it inside the server
    would be helpful

    There is an existing feature request for this, CR 31148

    Arun N.

Posting Permissions

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