Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 CONTAINS command, or equivalent ??

Author  Topic 

expatCanuck
Starting Member

2 Posts

Posted - 2009-05-12 : 12:53:07
Greetings -

I'd like to know if an SQL command exists that will let one find all records that contain a specified string in a specified field/column.

For example, assume that we have a list of publications. I'd like to know if it's possible in an MS-Access query to find all publications that have the string 'World' in their name (e.g. - Worldwide Zookeepers, World Zoos, Zoos of the World). Ideally case-insensitively.

I've been trying the LIKE command, but either I'm using it incorrectly, or it doesn't provide this functionality.

Thanks kindly.

- Richard
[url]http://oldWithoutMoney.com[/url]

expatCanuck
Starting Member

2 Posts

Posted - 2009-05-12 : 13:11:26
Hmmm. RTFM. Seems one needs to use wildcards to make LIKE work.
Go to Top of Page

tosscrosby
Aged Yak Warrior

676 Posts

Posted - 2009-05-12 : 16:54:25
where fieldname like '%world%' or where upper(fieldname) like '%WORLD%' if you're running a case sensitive collation).

Terry

-- Procrastinate now!
Go to Top of Page

Sequin
Starting Member

25 Posts

Posted - 2009-05-22 : 06:54:00
In MS Access, the wildcard characters are * and ?, not % and _ (or certainly were up to Access 2003)

Select * from Table where Field1 like "*world*"

Access is by default case insensitive
Go to Top of Page
   

- Advertisement -