Sunday, February 19, 2012

FullText Results from what column

I am running SQL 2000 - upgrading to 2005 hopefully Q1-2007

I have a table that has 12 columns fulltext indexed for searching. Is there a way to tell what column has the search string?

If it is not possible in 2000 what about 2005?

Thanks

If you do a query like select * from t1 where contains(*,'term') you cannot tell which column the hit was in.

You could do a set of queries with each column in turn if you wanted to tell where the term was found:

select * from t1 where contains(col1, 'term')

select * from t1 where contains(col2, 'term')

etc..

In SQL 2005 you can specify a column list in the query (rather than just a single column or *) so you could do queries like:

select * from t1 where conatins((col1,col2,col3), 'term')

Depending on your application that may be useful to you.

Hope this helps.

Dave

No comments:

Post a Comment