You can search for words or phrases in close proximity to another word or phrase. In addition, you can specify two words or phrases in any order and get the same result. For example, this example searches for the word user close to the word computers.
USE pubs
GO
SELECT title, notes
FROM titles
WHERE CONTAINS (notes, 'user NEAR computers')
GO
However, you can also reverse the words in the WHERE clause to get the same result:
WHERE CONTAINS (notes, 'computers NEAR user')
You can specify the tilde (~) in place of the NEAR keyword in the earlier queries, and get the same results:
WHERE CONTAINS (notes, 'computers ~ user')
More than two words or phase can be specified in the search conditions. For example, it is possible to say:
WHERE CONTAINS (notes, ' hardware ~ muckraking ~ computer ')
This means that hardware should be in close proximity to muckraking, and muckraking should be in close proximity to computer.
In addition, matching the prefix of a word can be combined with searching for a word or phrase in close proximity to another word or phrase, for example:
WHERE CONTAINS(Description, ' sauces ~ "mix*" ')
This example searches for all descriptions in which the description has sauces in close proximity to any form of mix, such as mixing, or mixed. Or, to find wheat bread mix and also wheatberry bread mix, you could use this type of search:
WHERE CONTAINS(Description, ' "wheat*" ~ "bread mix" ')
CONTAINS | WHERE |