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 > Other > Ingres CAST Syntax?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-02-05, 08:07
chrisp_999 chrisp_999 is offline
Registered User
 
Join Date: Mar 2002
Location: Bielefeld, Germany
Posts: 69
Ingres CAST Syntax?

Hi all!
I need to typecast an char(12) field to int on an Ingres DB via IngresII ODBC driver. I keep getting "CAST is not a function" errors. My google-fu fails me and I don't have any documentation at hand.
To provide some background: There is a table with a field "ID" that only contains numerical values, but the type is char(12) (no way for me to change that, duh). I need to find out the highest value, but MAX(ID) returns the highest value ordered lexically :/
Reply With Quote
  #2 (permalink)  
Old 02-02-05, 11:15
dbabren dbabren is offline
Registered User
 
Join Date: Jul 2003
Location: England
Posts: 152
you could try to convert by using int4(field) - this should convert the char to an integer value.
__________________
Regards
Dbabren
Reply With Quote
  #3 (permalink)  
Old 02-03-05, 04:58
PaulMason PaulMason is offline
Registered User
 
Join Date: Nov 2002
Posts: 33
As dbabren says max(int4(id)) is what you want. Also the docs are online in PDF format here ftp://ftp.ca.com/pub/ingres/docs/

HTH
Paul
__________________
Paul Mason
Reply With Quote
  #4 (permalink)  
Old 02-03-05, 05:21
chrisp_999 chrisp_999 is offline
Registered User
 
Join Date: Mar 2002
Location: Bielefeld, Germany
Posts: 69
Thank you both!

That's it
And thanks for the link, I'm sure that'' come in handy soon.
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