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

How to use a variable in an SQL "LIKE" statement? 1

Status
Not open for further replies.

guineamation

Programmer
Jan 29, 2002
58
IL
I would like to create a full text search on a DB column using the SELECT...LIKE type statement. How do I call the variable "form" for ex. into this statement.
 
I'll change your variable name for the example to "last," as "form" is a very bad name for a variable. :)

Here's what the SQL would look like:
Code:
SELECT * FROM MyTable WHERE LastName LIKE '%evans%'
So, for example, if you were assembling a sql string to add to your .open command, your asp might look like this:
Code:
strSQL = "SELECT * FROM MyTable WHERE LastName LIKE '%" & last & "'%"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top