Export (0) Print
Expand All

Searching for Words or Phrases Using Weighted Values (Weighted Term)

SQL Server 2000

Searching for Words or Phrases Using Weighted Values (Weighted Term)

You can search for words or phrases and specify a weighting value. Weight, a number from 0.0 through 1.0, indicates the degree of importance for each word and phrase within a set of words and phrases. A weight value of 0.0 is the lowest value available, and a weight value of 1.0 is the highest available value. For example, this query searches for all customer addresses, using weight values, in which any text beginning with the string "des" is near either Rue or Bouchers. Microsoft® SQL Server™ gives a higher rank to those rows with more of the words specified. Therefore, SQL Server gives a higher rank to a row with des Rue Bouchers than to a row with des Rue.

USE Northwind
GO
SELECT CompanyName, ContactName, Address   
FROM Customers
WHERE CONTAINS(Address, 'ISABOUT ("*des*", 
         Rue WEIGHT(0.5), 
         Bouchers WEIGHT(0.9)
         ) ' )
GO

A weighted term can be used in conjunction with any of the other four types of terms.

Show:
© 2015 Microsoft