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 > Informix > number to char

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-21-07, 10:54
georgipa georgipa is offline
Registered User
 
Join Date: Dec 2002
Location: Madrid - Spain
Posts: 283
Exclamation number to char

Hi,

I have a value at number and need to convert this number to char, there are some statement or function for this.

thank you for you hep.

greetings
Reply With Quote
  #2 (permalink)  
Old 03-22-07, 13:14
ifx ifx is offline
Registered User
 
Join Date: Feb 2005
Posts: 33
try this:
select concat('',yourcolumn) ...

then you can put further string functions around it:
select substr(concat('',yourcolumn),1,3) as youraliasname ...
Reply With Quote
  #3 (permalink)  
Old 03-26-07, 07:21
georgipa georgipa is offline
Registered User
 
Join Date: Dec 2002
Location: Madrid - Spain
Posts: 283
Thank you for you help,

You can tell me the systax it completes.

thank you.
Reply With Quote
  #4 (permalink)  
Old 03-27-07, 04:36
Tyveleyn Tyveleyn is offline
Registered User
 
Join Date: Aug 2006
Location: The Netherlands
Posts: 248
Georgipa,

From IDS 9.x up you can use the builtin cast functionality, like integer::char(x) or CAST(integer AS char(x)). Thus you can use string functions around it like:
Code:
SELECT length(integer::varchar(10))
FROM table
Works more straightforward than concatenation or other functions...

BTW. If you're talking about Informix 4GL: implicit casts are done by assigning a numeric value to a character variable so nothing special has to be done.

Regards
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

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