Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2007
    Posts
    23

    Unanswered: 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

  2. #2
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •