Convert varchar to numeric in Informix

Posted by user302705 on Stack Overflow See other posts from Stack Overflow or by user302705
Published on 2010-03-26T16:38:57Z Indexed on 2010/03/26 16:43 UTC
Read the original article Hit count: 366

Filed under:
|
|

Hi All

I have problem while converting varchar type to Int type in Informix. Actually I dont know if the value is really varchar or not which I want to convert to INT. Its a sandbox system.

As Example: I am trying to run this kind of

Select telnumber from numbers n where Cast(n.telnumber AS INT) between 1234 and 9999

I got this error: "Character to numeric conversion error"

If I run this query like this:

Select telnumber from numbers n where n.telnumber between '1234' and '9999'

it brings a resultset but not in the range that I defined.

130987 130710 130723

How can I convert telnumber to a numeric value and use it in "between" 1234 and 9999 range

Thanks in advance.

© Stack Overflow or respective owner

Related posts about informix

Related posts about convert