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 > Search function works in access but not db2 using like and %

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-12-04, 17:15
jpalazzi jpalazzi is offline
Registered User
 
Join Date: Nov 2004
Posts: 16
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...
Reply With Quote
  #2 (permalink)  
Old 11-12-04, 17:18
Marcus_A Marcus_A is online now
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
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
Reply With Quote
  #3 (permalink)  
Old 11-12-04, 17:21
jpalazzi jpalazzi is offline
Registered User
 
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.
Reply With Quote
  #4 (permalink)  
Old 11-12-04, 17:25
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
What's the data type of CUSTOMER_ID? You can't use LIKE with non-character fields.
Reply With Quote
  #5 (permalink)  
Old 11-12-04, 17:26
jpalazzi jpalazzi is offline
Registered User
 
Join Date: Nov 2004
Posts: 16
oh...well my customer_id is an integer that is auto generated.
Reply With Quote
  #6 (permalink)  
Old 11-12-04, 17:27
jpalazzi jpalazzi is offline
Registered User
 
Join Date: Nov 2004
Posts: 16
Is There A Way To Do It?
Reply With Quote
  #7 (permalink)  
Old 11-12-04, 17:33
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
As a workaround you could use "...WHERE CHAR(CUSTOMER_ID) LIKE..." or apply some arithmetics to the actual CUSTOMER_ID.
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