Results 1 to 7 of 7
  1. #1
    Join Date
    Nov 2004
    Posts
    16

    Unanswered: Search function works in access but not db2 using like and %

    I have a search function
    select lname from tbl_customer where customer_id like '% 2002 %'

    it works fine in access, but it errors and seems not to like the % and the like.

    If i set it = then it works fine.

    any ideas...

  2. #2
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    Do you need the spaces? Will this work:

    like '%2002%'
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

  3. #3
    Join Date
    Nov 2004
    Posts
    16
    spaces dont seem to matter
    this is the error it throws:
    No authorized routine named "LIKE" of type "FUNCTION" having compatible arguments was found.

  4. #4
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    What's the data type of CUSTOMER_ID? You can't use LIKE with non-character fields.

  5. #5
    Join Date
    Nov 2004
    Posts
    16
    oh...well my customer_id is an integer that is auto generated.

  6. #6
    Join Date
    Nov 2004
    Posts
    16
    Is There A Way To Do It?

  7. #7
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    As a workaround you could use "...WHERE CHAR(CUSTOMER_ID) LIKE..." or apply some arithmetics to the actual CUSTOMER_ID.

Posting Permissions

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