Full Text Indexing

  • I have a column that is full-text indexed.

    If I do a query on the column using LIKE %% instead of CONTAINS will SQL Server use the full-text index?

    SELECT *

    FROM SomeTable WITH (NOLOCK)

    WHERE CONTAINS([Description], 'GO')

    SELECT *

    FROM SomeTable WITH (NOLOCK)

    WHERE [Description] LIKE '%GO%'

  • Does anyone know the answer?

  • As far is i know you have to use the CONTAINS method to make usage of the fulltext search.

    So the answer is NO

    But ofcourse there is a very simple way to test it: just run the 2 queries and compare the execution plans 😉

  • If I do a query on the column using LIKE %% instead of CONTAINS will SQL Server use the full-text index?

    Short answer: NO

    Long answer: The SQL engine uses various words such as IN, LIKE, CONTAINS, etc. to determine logic. If LIKE always performed a full-text query then you could never perform a wildcard match using LIKE.

    Note: CONTAINS is a semi-portable full-text operand as it also exists in Oracle.


    [font="Arial Narrow"](PHB) I think we should build an SQL database. (Dilbert) What color do you want that database? (PHB) I think mauve has the most RAM.[/font]

  • Thanks so much for your help!!

  • By using the contains you can search for words and phrases but with like you can search for characters containing in the word as well.

    like %a% will result all the records containing a like apple, aeroplane etc.

    whereas contains will search for 'apple' it will not return the result like 'Like' keyword.

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply