Bizarre Behavior with LIKE Operator

whdyck

Registered User.
Local time
Today, 12:15
Joined
Aug 8, 2011
Messages
169
I'm using MS Access 2003.

I have a SQL Server table with some records (not all) whose "description" column contains a vessel name embedded inside. I'd like to select the records whose description contains one of the vessel names in another table. In SQL Server Mgt Studio, if I run the following code, I get back 1959 rows:

Code:
SELECT c.vessel_id, a.description
FROM dba.fin_gl_audit_trail AS a
       ,dba.s1_vessel AS c
WHERE UPPER(a.description) LIKE '%' + c.vessel_id + '%'

However, when I convert it to the Access equivalent (using linked tables via ODBC) and run against the same DB, it returns zero rows:

Code:
SELECT c.vessel_id, a.description
FROM dba_fin_gl_audit_trail AS a
    ,dba_s1_vessel AS c
WHERE UCase(a.description) LIKE '%' + c.vessel_id + '%'

Any idea why?

Thanks for any help you can give.

Wayne
 
In an Access query, use * as the wildcard.
 
Hmmm. Your suggestion worked.

Weird thing is that I've used the % wildcard in other Access queries, and it's worked.

Thanks.

Wayne
 

Users who are viewing this thread

Back
Top Bottom