Solved

Using a wildcard in a where statement

Posted on 2015-02-13
1
85 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.

911 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now