Character to Numeric Conversion
Posted in 2000
Topics: SQL Development & Query Writing
Hi, I want to convert a character field to numeric. For Micrsoft or Sybase SQL server v6.5 the select statement is: Convert(char,Tablename.Customer_ID) Does Informix have something like that? Thanks in advance Alex
Depends on version of IDS. For example for IDS-9.x tablename.customer_id::char(10) -- ala c++ In earlier versions of IDS this isn't supported. Pietje Puk <Pietje@puk.com> ''''' ' ''''''''':3a028dde$0$25544@news2.zeelandnet.nl... > Hi, > > I want to convert a character field to numeric. > > For Micrsoft or Sybase SQL server v6.5 the select statement is: > Convert(char,Tablename.Customer_ID) > > Does Informix have something like that? > > Thanks in advance > > Alex > > >
Working on 7.24, switching to 7.31 in a couple of weeks. So, does 7.31 support this? Alex "Sergey E. Volkov" wrote: > Depends on version of IDS. > For example for IDS-9.x > > tablename.customer_id::char(10) -- ala c++ > > In earlier versions of IDS this isn't supported. > > Pietje Puk <Pietje@puk.com> ÐÉÛÅÔ × > ÓÏÏÂÝÅÎÉÉ:3a028dde$0$25544@news2.zeelandnet.nl... > > Hi, > > > > I want to convert a character field to numeric. > > > > For Micrsoft or Sybase SQL server v6.5 the select statement is: > > Convert(char,Tablename.Customer_ID) > > > > Does Informix have something like that? > > > > Thanks in advance > > > > Alex > > > > > >
What are you using for a front-end? Know that Informix automatically converts fetched columns to match the type of the corresponding host/bind variable if possible. So if you want to fetch that char column into a numeric host var in ESQL/C, 4GL, or CLI just do it. If it cannot be done, ie a row contains a non-numeric value, you will get a -12xx error code. Art S. Kagel Alex Bernaards wrote: > > Working on 7.24, switching to 7.31 in a couple of weeks. > > So, does 7.31 support this? > > Alex > > "Sergey E. Volkov" wrote: > > > Depends on version of IDS. > > For example for IDS-9.x > > > > tablename.customer_id::char(10) -- ala c++ > > > > In earlier versions of IDS this isn't supported. > > > > Pietje Puk <Pietje@puk.com> ÐÉÛÅÔ × > > ÓÏÏÂÝÅÎÉÉ:3a028dde$0$25544@news2.zeelandnet.nl... > > > Hi, > > > > > > I want to convert a character field to numeric. > > > > > > For Micrsoft or Sybase SQL server v6.5 the select statement is: > > > Convert(char,Tablename.Customer_ID) > > > > > > Does Informix have something like that? > > > > > > Thanks in advance > > > > > > Alex > > > > > > > > >