Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

Go Back  dBforums > Database Server Software > Sybase > Trapping Convert function error (Urgent)

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-23-04, 10:33
akshey58 akshey58 is offline
Registered User
 
Join Date: Oct 2003
Posts: 4
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.

Example

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

Thanks
Akshey
Reply With Quote
  #2 (permalink)  
Old 06-23-04, 11:08
arrunkumaar arrunkumaar is offline
Registered User
 
Join Date: Feb 2004
Posts: 9
Hi,

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 (http://www.isug.com)

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

Ans:
There is an existing feature request for this, CR 31148

Thanks,
Arun N.
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

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