Skip to content Skip to sidebar Skip to footer

Using Fts Query, Can You Find All Entries Contains 'abc'

I am new to Full Text Search, how do I perform a search using Contains instead of using like in the following query Select * From Students Where FullName LIKE '%abc%' Thanks

Solution 1:

Something like:

SELECT*From Students WhereCONTAINS(FullName,'abc')

Link to MSDN documentation

Solution 2:

Check when your catalog was last populated using this script:

DECLARE@CatalogNameVARCHAR(MAX)
SET@CatalogName='FTS_Demo_Catalog'SELECT
    DATEADD(ss, FULLTEXTCATALOGPROPERTY(@CatalogName,'PopulateCompletionAge'), '1/1/1990') AS LastPopulated
    ,(SELECTCASE FULLTEXTCATALOGPROPERTY(@CatalogName,'PopulateStatus')
        WHEN0THEN'Idle'WHEN1THEN'Full Population In Progress'WHEN2THEN'Paused'WHEN3THEN'Throttled'WHEN4THEN'Recovering'WHEN5THEN'Shutdown'WHEN6THEN'Incremental Population In Progress'WHEN7THEN'Building Index'WHEN8THEN'Disk Full.  Paused'WHEN9THEN'Change Tracking'END) AS PopulateStatus
FROM sys.fulltext_catalogs AS cat

You may need to re-populate your Full Text Index in order to see current results. If you defined the FTS column, and then loaded data into the table, your search index is not up to date.

enter image description here

If you need this to be regularly updated, check out this article on Tech Net

Solution 3:

If "abc" is a partial match for what you are really seeking, alter your CONTAINS statement like this:

SELECT*FROM     Students 
WHERECONTAINS(FullName, '"abc*"')

OR

SELECT*FROM     Students 
WHERECONTAINS(FullName, '"*abc*"')

Source: MSDN - CONTAINS

Post a Comment for "Using Fts Query, Can You Find All Entries Contains 'abc'"