Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


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


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

Author
Message
sweeneyliam71
sweeneyliam71
Forum Newbie
Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)

Group: General Forum Members
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
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search