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 > DB2 > Comparing an Integer value with a VARCHAR value

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-18-07, 03:23
desmondtanck desmondtanck is offline
Registered User
 
Join Date: Apr 2007
Posts: 23
Comparing an Integer value with a VARCHAR value

At other database system, for example, i can use:
select * from table where abc>=def

where abc is an Integer value, def is a varchar which contain '30',
so the system will automatically convert 'def' to integer value for
comparison.

But for DB2, it doesnt seems to do that, so what should i do to
make these kind of comparison works?

thanks,
Desmond
Reply With Quote
  #2 (permalink)  
Old 04-18-07, 03:57
guyprzytula guyprzytula is offline
Registered User
 
Join Date: Jun 2006
Posts: 471
db2 will not convert this for you
you have to make the datatype compatible
or translate integer to char or translate char to integer
where abc=int(def)
or
where char(abc)=def
__________________
Best Regards, Guy Przytula
DB2 UDB LUW certified V6/7/8
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