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

Search: Wildcards 1

Status
Not open for further replies.

bluelake367

Programmer
Aug 22, 2001
3
US
I'm new to this and never been able to get this to work. I have a text box for a search. Where I want a user to search for their request by their name -- but I want to allow them to put only a partial name or just their last name, not to be a literal string search match.

So using the simple RecordQuery form, if I set it up with the filter on the RequestedBy field it gives me this.

SELECT *
FROM MAC
WHERE RequestedBy = 'MMColParam'

What would have to be the SQL to say, give me anything that matches the string that is passed from the form.

The search form is a Get method (I'm using ASP) and the form name is "SearchName" and the form text box is "RequestedBy" So I have the parts but can't figure out how to get them together. Anyone shed some light? What the heck is MMColParam, anyways?
 
WHERE RequestedBy LIKE '%MMColParam%'

is the SQL Server solution -- which also happens to be the only one I know, so I hope it's what you need. ;-)

penny.gif
penny.gif
 
SELECT *
FROM MAC
WHERE RequestedBy = '%MMColParam%'

Alright the SQL Statement looks like this.

Under the box for "variables" in UltraDev it says

Name Default Value Runtime value

MMColParam What do I put here? Request.QueryString("RequestedBy")

Just putting the % in the where statement doesn't get me anything?
 
Figured it out -- thanks for the help and a bit of playing on my own:

SELECT *
FROM MAC
WHERE RequestedBy LIKE '%MMColParam%'

I was missing the LIKE and then in the default value for the variable you put %

Thanks for putting me on the right track.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top