2012年3月27日星期二

full text searches

sql2k sp3a
Im having a hard time getting my head into full text searches. I really dont
understand the difference between a full test search and a LIKE clause?
If its not too much trouble, could someone please provide an example of a
query that can ONLY be done using a full text search and not the LIKE
clause.
TIA, ChrisRThe key is to study CONTAINS, FREETEXT, CONTAINSTABLE and FREETEXTTABLE. For example, here are a
couple of examples from Books Online, CONTAINS:
F. Use CONTAINS with <generation_term>
This example searches for all products with words of the form dry: dried, drying, and so on.
USE Northwind
GO
SELECT ProductName
FROM Products
WHERE CONTAINS(ProductName, ' FORMSOF (INFLECTIONAL, dry) ')
GO
G. Use CONTAINS with <weighted_term>
This example searches for all product names containing the words spread, sauces, or relishes, and
different weightings are given to each word.
USE Northwind
GO
SELECT CategoryName, Description
FROM Categories
WHERE CONTAINS(Description, 'ISABOUT (spread weight (.8),
sauces weight (.4), relishes weight (.2) )' )
GO
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"ChrisR" <noemail@.bla.com> wrote in message news:uqZGHZZiFHA.3056@.TK2MSFTNGP10.phx.gbl...
> sql2k sp3a
> Im having a hard time getting my head into full text searches. I really dont understand the
> difference between a full test search and a LIKE clause?
> If its not too much trouble, could someone please provide an example of a query that can ONLY be
> done using a full text search and not the LIKE clause.
>
> TIA, ChrisR
>

没有评论:

发表评论