i have 15 columns in my db.
can u pls guide how to use the like operator search? in sql 2008?
Sql search using like operator?
4 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Jignesh TrivediRank #16 · 50.3K reputationPosted Aug 9, 2012, 11:00 PM EDT
you can use like operator with any of you column.
example..
Select * from Table1 where column1 like '%test%'
please refer
http://msdn.microsoft.com/en-us/library/ms179859.aspx
http://www.codeproject.com/Articles/33941/SQL-LIKE-Operator
hope this will help you.
sudharsan s110 reputationPosted Aug 9, 2012, 11:04 PM EDT
you mentioned %test% in above query.. but i am giving textbox to enter the serach words,
so the search words should not oly the text. it should be anything.
so, how can i change %text% into textbox post values
Jignesh TrivediRank #16 · 50.3K reputationPosted Aug 9, 2012, 11:51 PM EDT
in above example you must replace test value to your textbox value..
please refer above two link, it can help you how we use Wildcard Characters and ESCAPE Clause for special Characters.
hope this will help.
Akkiraju IvaturiRank #473 · 5.3K reputationPosted Aug 12, 2012, 6:41 PM EDT
Symbol
Meaning
LIKE '5[%]'
5%
LIKE '[_]n'
_n
LIKE '[a-cdf]'
a, b, c, d, or f
LIKE '[-acdf]'
-, a, c, d, or f
LIKE '[ [ ]'
[
LIKE ']'
]
LIKE 'abc[_]d%'
abc_d and abc_de
LIKE 'abc[def]'
abcd, abce, and abcf