Serach for a particular string in different columns in a table

  • Hi,

    is there a simpler way to search for a partcular string in different columns in a table. currently I have the following case statement. it's working fine but I was wondering if there is another way to do it?

    case

    when

    tbl_Name.Col_1=1

    or

    tbl_Name.Col_2 like '%MyString%'

    Or

    tbl_Name.Col_3 like '%MyString%'

    or

    tbl_Name.Col_4 like '%MyString%'

    or

    tbl_Name.Col_5 like '%MyString%'

    Then 1

    else 0

    End

  • Have you tried Full Text Indexing?

    John

  • I have never used it before may you please post example

  • - You can create a computed column and search on it

    Or

    - Try to do that with Full-Text Search

    http://msdn.microsoft.com/en-us/library/ms142571.aspx

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply