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 > CAST function on Informix 7.20

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-28-02, 00:42
ramram49 ramram49 is offline
Registered User
 
Join Date: Aug 2002
Posts: 16
Question CAST function on Informix 7.20

My company is using an Informix DBMS version 7.20 on a SCO Unix machine (should be version 5). I want to convert a DATE field to CHAR data type for comparision.

For example, the DATE field named TheDate, with data '2001/02/20'. I want it output as 0220.

However, I cannot use TO_CHAR and CAST functions.

Anybody know if there is any similar function I can use in the SQL command?

Thanks
Reply With Quote
  #2 (permalink)  
Old 11-28-02, 10:48
Roelwe Roelwe is offline
Registered User
 
Join Date: Aug 2002
Location: Belgium
Posts: 534
You can use square brackets. I think it's something like this:

Select thedate[6,2] || thedate[9,2]
from table...
__________________
rws
Reply With Quote
  #3 (permalink)  
Old 11-28-02, 19:50
ramram49 ramram49 is offline
Registered User
 
Join Date: Aug 2002
Posts: 16
I think square brackets work only for text. How can I change the DATE field to a TEXT type.

Quote:
Originally posted by Roelwe
You can use square brackets. I think it's something like this:

Select thedate[6,2] || thedate[9,2]
from table...
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