Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

How to filter a search for key words that appear within 2 words of each other. Expand / Collapse
Author
Message
Posted Wednesday, April 10, 2013 9:23 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, April 18, 2013 9:59 PM
Points: 4, Visits: 22
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
3 Free Program
4 A Simple Formula to Calculate the ISO Week Number (SQLServerCentral 4/8/2013)
6 Your Oracle Database Training Newsletter
8 Tune SQL Server 2012 Databases Using Database Engine Tuning Advisor (SQLServerCentral
11 How to execute a SQL command
12 How to execute a SQL cmd
13 Starting and executing an SQL command line
14 Classes starting soon
15 How to create a view
Post #1440880
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse