Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Fulltext-Query over multiple Columns

Author  Topic 

lentinus
Starting Member

1 Post

Posted - 2011-05-13 : 04:47:45
Hello,

i have a table with 2 fulltext-indexed columns.
Now i would like to create an fulltext-query over the 2 columns.

SELECT * FROM table WHERE CONTAINS((col1,col2), '"298" AND "hugo"')

I will get all rows which col1+col2 contains "298" AND "hugo". But my query does not work!

Following query works fine, but the performance is poor if i have several columns:

SELECT * FROM table WHERE CONTAINS(col1, '"298" OR "hugo"') AND CONTAINS(col2, '"298" OR "hugo"')

What is the best way to do that?
Thanks!

best regards,
Stephan Blaurock

Praney
Starting Member

1 Post

Posted - 2011-05-17 : 05:51:52
SELECT * FROM table WHERE FREETEXT(*, '298 hugo');

FREETEXT( ) Is predicate used to search columns containing character-based data types. It will not match the exact word, but the meaning of the words in the search condition. When FREETEXT is used, the full-text query engine internally performs the following actions on the freetext_string, assigns each term a weight, and then finds the matches.

Separates the string into individual words based on word boundaries (word-breaking).
Generates inflectional forms of the words (stemming).
Identifies a list of expansions or replacements for the terms based on matches in the thesaurus.

Praney
Go to Top of Page
   

- Advertisement -