
Untitled
By: a guest on
May 22nd, 2012 | syntax:
None | size: 0.58 KB | hits: 18 | expires: Never
Creating dynamic search using T-SQL stored procedures
select * from table
where
(word is like @word1)
and (word is like @word2)
declare @wordtable table(word varchar(20))
declare @table table(word varchar(500))
insert @wordtable values('car')
insert @wordtable values('wheel')
insert @table values('carwheel')
insert @table values('car')
insert @table values('wheel')
insert @table values('wheelcat')
select * from @table t
where not exists (select 1 from @wordtable where t.word not like '%' + word + '%')
(word is like @word1)
and (word is like @word2)