Search This Blog

SQL server 2008 : FULL-TEXT CONTAINS VS. XQUERY CONTAINS

The full-text search CONTAINS predicate is not the same as the XQuery contains predicate. The XQuery contains predicate performs a substring match similar to the T-SQL CHARINDEX function. The matches performed by the XQuery contains predicate are case sensitive.
The T-SQL CONTAINS predicate, on the other hand, includes all of the flexibility of the SQL Server full-text search functionality. This includes the ability to perform thesaurus lookups, word stemming, and proximity searches.

The downside to the T-SQL CONTAINS predicate is that you cannot specify node paths to narrow your search using them. The T-SQL full-text search is an all-or-nothing proposition—if you want to search for a word in your XML data using a full-text search, the word can appear anywhere in the XML content. This is why it makes sense to use the T-SQL CONTAINS predicate in conjunction with the XQuery contains predicate for maximum flexibility and performance.