• dbuendiab (1/5/2010)


    I think you have already several good answers, or at last the kind I would have suggested before this one. Despite of this, and only as a alternative to consider, you could concatenate the string fields before LIKE comparison (you'll can't expect high performance, I guess):

    Select *

    From Table

    Where col1 + col2 + col3 like '%' + 'SearchedString' + '%'

    You need to make sure to separate each column. Otherwise you might get wrong results.

    DECLARE @t TABLE (col1 varchar(10), col2 varchar(10) ,col3 varchar(10))

    INSERT INTO @t values('book shelf','red','Mike')

    Select *

    From @t

    Where col1 + col2 + col3 like '%' + 'fred' + '%'

    -- versus

    Select *

    From @t

    Where col1 + '_' + col2 + '_' + col3 like '%' + 'red' + '%'



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]