You are here: Replace Multiple LIKEs « MsSQL Server « IT news, forums, messages
Replace Multiple LIKEs

Posted by laurenquantrell on 10/13/02 11:59

I have a query below that performs horribly:

@KeywordOne char(6),
@KeywordTwo char(6),
@KeywordThree char(6),
@KeywordFour char(6),
@KeywordFive char(6)


SELECT
c.Something
FROM
dbo.tblStuff c
WHERE
c.SomeColumnName = 0
AND (c.Keyword LIKE '%' + @KeywordOne + '%' OR @KeywordOne is Null)
AND (c.Keyword LIKE '%' + @KeywordTwo + '%' OR @KeywordTwo is Null)
AND (c.Keyword LIKE '%' + @KeywordThree + '%' OR @KeywordThree is
Null)
AND (c.Keyword LIKE '%' + @KeywordFour + '%' OR @KeywordFour = is
Null)
AND (c.Keyword LIKE '%' + @KeywordFive + '%' OR @KeywordFive = is
Null)

The contents of column c.Keyword looks like this:
Row1: 123456,321654,987987,345987
Row2:
Row3: 123456,987987
etc.

What can I do to get this to perform reasonably? I cannot use full-text
search.
Any help is appreciated.
lq

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация