Link to home
Start Free TrialLog in
Avatar of svasilakos
svasilakos

asked on

Is there a way to use Wildcards with a LIKE compare statement in SQL

I have a stored procedure where I'm searching a table for Customers Name. SO for example

I have a parameter   @LastName

Is there a way to use the LIKE function with some sort of WildCard?

Such as Select LastName from Customer where LastName LIKE @LastName+'%'

I know that doesn't work but I'm trying to figure out the best way to use soem sort of wildcard so if the user is searching for a customer with lastname of JONES, they can just enter JON and see all the customers whose lastnames begin with JON.

I'm calling this sp from an aspx web page I can probable do the wild card through aspx but if I can just do it through the SP that would be better.

Thanks


ASKER CERTIFIED SOLUTION
Avatar of Richard Quadling
Richard Quadling
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of svasilakos
svasilakos

ASKER

I'm kind of an idiot. I didn't even try what I wrote in my question, I just thought I did and didn't think it would work.   That's the ticket...

Thanks for the Fast response.

-Steve, Las Vegas
Glad to have helped.