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
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Glad to have helped.
ASKER
Thanks for the Fast response.
-Steve, Las Vegas