If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Sybase > An error occured in SP

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-15-09, 05:38
xotesa xotesa is offline
Registered User
 
Join Date: Jun 2009
Posts: 16
An error occured in SP

select @isOK = convert(smallint,isnull(isSet,"0"))

Hi...

I have a NULL value there and i get this error.

isSET is null by the way.
Also isSET value is String in my Java class and it is assigned null at first.


Syntax error during explicit conversion of VARCHAR value 'null' to a SMALLINT field.

What may be the error?

Does not it set the isSet value to "0" and then this varchar "0" value to a smallint?

Last edited by xotesa; 06-15-09 at 05:43.
Reply With Quote
  #2 (permalink)  
Old 06-15-09, 08:27
Martijnvs Martijnvs is offline
Registered User
 
Join Date: Jan 2004
Location: The Hague/Utrecht, NL
Posts: 396
You are trying to convert the string zero to an integer. If you use select @isOK = convert(smallint,isnull(isSet,0)) it would be okay.
__________________
I'm not crazy, I'm an aeroplane!
Reply With Quote
  #3 (permalink)  
Old 06-15-09, 10:33
xotesa xotesa is offline
Registered User
 
Join Date: Jun 2009
Posts: 16
Thanks. I changed "null" values to null.
Reply With Quote
  #4 (permalink)  
Old 06-25-09, 15:50
darshanmeel darshanmeel is offline
Registered User
 
Join Date: Jun 2009
Posts: 2
You were passing isSet as "NULL" not as NULL.That was the issue.Thanks,
Reply With Quote
Reply

Thread Tools
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

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