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
 Question in LIKE statement

Author  Topic 

lsy
Yak Posting Veteran

57 Posts

Posted - 2005-09-26 : 21:08:24
i'm using MS Access database to store my data... when i wanna query a LIKE statement it seem doesn't work...

columnX
--------
<test>abc
cde
<test>jkl
<try>sjs
jdh

my sql as
SELECT * FROM TABLE WHERE columnX LIKE '<%>'

Kristen
Test

22859 Posts

Posted - 2005-09-26 : 21:27:37
That will find a value that starts with "<" and ends with ">" whereas your example data has text following the ">"

So maybe you need:

SELECT * FROM TABLE WHERE columnX LIKE '<%>%'

or possibly even

SELECT * FROM TABLE WHERE columnX LIKE '%<%>%'

Kristen
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2005-09-26 : 21:37:48
Access uses * as a wildcard.
Go to Top of Page

lsy
Yak Posting Veteran

57 Posts

Posted - 2005-09-26 : 22:16:41
thanks all... i never know access was using * as wildcard...:)
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2005-09-27 : 03:18:10
And I thought it supported either!

Wrong again

Kristen
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2005-09-27 : 08:52:18
quote:
Originally posted by Kristen

And I thought it supported either!

Wrong again

Kristen



If the data is stored locally in an Access table, you need to use *. But if the data is stored remotely in a linked table to SQL Server, then you can use % or *. Access will essentially replace * with % in a like clause when it converts the SQL and passes it to the server.

Finally, in an ADP project, which is essentially 100% sql server (no JET involved), then you need to use % exclusively.

It is kind of confusing and not really clearly defined anywhere as far as I can tell.
Go to Top of Page
   

- Advertisement -