2014-10-21 10:43:00
As far as I know there are two commands that can be used for fizzy searches CONTAINSTABLE
, CONTAINS
.
CONTAINSTABLE
Example
SELECT DISTINCT c.ContractorID FROM Contractor AS c INNER JOIN CONTAINSTABLE(Contractor, *, '"*Doyle*"') AS k ON c.ContractorID = k.[KEY]
CONTAINSTABLE
has to be part of an INNER JOIN
.
*
means search all columns.
See: CONTAINSTABLE (Transact-SQL)
CONTAINS
Example
SELECT * FROM Contractor WHERE CONTAINS(*, '"*doyle*"', LANGUAGE 2057)
The LANGUAGE
is optional.
sys.fulltext_system_stopwords
Both functions rely on a system table called sys.fulltext_system_stopwords
. This table contains a list of stop words in many languages. If a search work is in this list the search process will stop.
To tell the fuzzy search to ignore the stopwords list run the following statement on the table:
ALTER FULLTEXT INDEX ON dbo.Contractor SET STOPLIST = OFF
To turn on use:
ALTER FULLTEXT INDEX ON dbo.Contractor SET STOPLIST = SYSTEM
References
ALTER FULLTEXT INDEX (Transact-SQL) - Microsoft
Configure and Manage Stopwords and Stoplists for Full-Text Search