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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query using LIKE 1

Status
Not open for further replies.

TheConeHead

Programmer
Aug 14, 2002
2,106
0
0
US
I am trying:

"SELECT * from table where column LIKE '"+variable+"'"

It works if the variable exactly matches the column (ie name@domain.com) but not if it includes part of it (ie domain)

Shouldn't LIKE return it either way?

[conehead]
 
You need to include the percent signs before and after the text to locate. It should be:

Code:
SELECT * from table where column LIKE '%"+variable+"%'

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top