Solved

Using a wildcard in a where statement

Posted on 2015-02-13
1
97 Views
Last Modified: 2015-02-13
I have  a field 'NAME' that can contain first and last names.
I would like to have a textbox that can collect a submitted last name to perform a  search....something like :

Select * FROM tblCustomers
WHERE NAME LIKE '%SMITH'
This would return all John Smith, Fred Smith and so on...

I have a stored procedure that will be referencing a textbox called 'txtNAME'. In my where statement how would the wildcard look?   NAME LIKE '%' + @NAME ? (@NAME is the declared variable)
0
Comment
Question by:ITMikeK
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 75

Accepted Solution

by:
Aneesh Retnakaran earned 500 total points
ID: 40608377
Select * FROM tblCustomers
 WHERE NAME LIKE '%'+@name
0

Featured Post

How Blockchain Is Impacting Every Industry

Blockchain expert Alex Tapscott talks to Acronis VP Frank Jablonski about this revolutionary technology and how it's making inroads into other industries and facets of everyday life.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

626 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question