How to filter a search for key words that appear within 2 words of each other.

  • I am new to full text indexing and SQL. I have created a table, populated the the table and enabled the full text indexing. The table consists of three columns id, SubjectText and ContentText. I populated the table with emails and now want to search for key words,program, code, database, execute,SQL, and class that are within 2 words of each other in the ContentText and return the id and SubjectText. I am not sure how to apply the WITHIN2 filter? Here is what I have so far and thew results any help would be appreciated.

    select id, SubjectText from dbo.email where contains

    ([ContentText],' execute ' )

    union

    select id, SubjectText from dbo.email where contains

    ([ContentText],' code')

    union

    select id, SubjectText from dbo.email where contains

    ([ContentText],' class ')

    union

    select id, SubjectText from dbo.email where contains

    ([ContentText],' program ')

    union

    select id, SubjectText from dbo.email where contains

    ([ContentText],' SQL')

    Results

    3Free Program

    4A Simple Formula to Calculate the ISO Week Number (SQLServerCentral 4/8/2013)

    6Your Oracle Database Training Newsletter

    8Tune SQL Server 2012 Databases Using Database Engine Tuning Advisor (SQLServerCentral

    11How to execute a SQL command

    12How to execute a SQL cmd

    13Starting and executing an SQL command line

    14Classes starting soon

    15How to create a view

Viewing 0 posts

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