Using full text searches with multi keywords and multi columns

Discussion in 'Databases' started by cgwp, Sep 15, 2008.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. I am looking for a generalized solution to selecting data from a series of full text indexed columns on a table in SQL Server 2005. Currently I build this up using a dynamic sql statement on an ASP (classic) page, but it struck me that since most web sites offer some variation of this, there may be a generalized solution.

    I'd like to be able to pass a list of keywords and a 'match type' (any words, all words, exact match) as parameters to a procedure and return a list of id's that match the query.

    In my application I have multiple columns that are full text indexed and I want to find all records that have all values in the table, not necessarily in one column. Therefore:
    select id from table where CONTAINS (*, ' '*keyword1*' AND '*keyword2*' ')
    will not work. The query has to be written as:
    select id from table where CONTAINS (*, ' '*keyword1*'') AND CONTAINS (*, ' '*keyword2*'')

    Are there any examples out there of doing this type of search in a stored procedure or function?

    Thanks

    marc
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page