All Forums General
SCHINN 11 posts Joined 09/12
09 Apr 2013
Cast from CHAR(20) to SMALLINT

Hello Friends.
I am trying to convert a column havign CHAR(20) to SMALLINT and getting the below error....
I have the below distinct values....as char(20).
this query Cast(cast(red_Cd as CHAR(3)) AS SMALLINT) and getting this error.
Bad character in date or format..you help is appreciated..thanks...
 
?
-1
100
101
102
104
106
110
111
112
119
204
205
211
300
302
303
304
306
307
309
310
311
313
315
316
500
 

Thanks...

Thanks...
Tags:
KS42982 137 posts Joined 12/12
09 Apr 2013

I just created the same scenario on my databases (13 & 14) and it worked fine w/o any error, unless '?' is actually 'question mark' and not representing the NULL value.
Are you sure, it is throwing the error at this particular statement ?

You must sign in to leave a comment.