i have 15 columns in my db.
can u pls guide how to use the like operator search? in sql 2008?
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Jignesh TrivediPosted Aug 10, 2012, 3:00 AM
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.
Akkiraju IvaturiPosted Aug 12, 2012, 10:41 PM
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
Jignesh TrivediPosted Aug 10, 2012, 3:51 AM
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.
sudharsan sPosted Aug 10, 2012, 3:04 AM
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