Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select statement

Status
Not open for further replies.

TMRO

Technical User
Jan 10, 2003
140
CA
Hi everybody!

I'm totally confused.
I run this select statement
select * from Author where Cname like "%Bill%"

And is not returning any results.

If I run
select * from Author where Cname like "Bill the King" is returning the wanted record

What am I missing?

Thanks,
TMRO
 
Hi

% means a single character your query is looking for a row with somecharacter followed by Bill followed by somecharacter

Try Bill%
Bill*
*Bill*

to ses what I mean and the difference between the wild card characters Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Hi TMRO!

This is from the A2K help file:

It is important to note that the ANSI SQL wildcards (%) and (_) are only available with Microsoft® Jet version 4.X and the Microsoft OLE DB Provider for Jet. They will be treated as literals if used through Microsoft Access or DAO.

It seems you must use the * in Access.

hth
Jeff Bridgham
bridgham@purdue.edu
 
HI

Further to comments about % and DAO, I think in older versions of Jet and/or DAO you will find that ? does the trick

so try

Try Bill?
Bill*
*Bill*

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
It's works with *
Thanks guys!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top