Solved

Using a wildcard in a where statement

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
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…
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.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

706 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

11 Experts available now in Live!

Get 1:1 Help Now