Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL Server 2008 - Full Text Search

I have a table:

WID          WName
2          Looking for Data
6          What data is here
7          Nothing
8          Here we go again

I created a Full Text Catalog on the WName Column.

When I use:

SELECT * FROM Workspace WHERE CONTAINS (WorkspaceName, ' "data* here*" ') -- Nothing 
SELECT * FROM Workspace WHERE FREETEXT (WorkspaceName, 'data*') -- Row ID: 2,6
SELECT * FROM Workspace WHERE FREETEXT (WorkspaceName, 'here*')  -- Nothing 
SELECT * FROM Workspace WHERE FREETEXT (WorkspaceName, '*ere*')  -- Nothing 
SELECT * FROM Workspace WHERE FREETEXT (WorkspaceName, 'here')  -- Nothing 
SELECT * FROM Workspace WHERE FREETEXT (WorkspaceName, 'data') --Row ID: 2,6

These are not the results that I expected.

What I want to be able to do is: If I had a color column with values

red
blue
blueberry
yellow, blue

I want to use a search of 'red blue' and have all of the above rows come back.

Is that possible?

like image 834
Don Avatar asked Jun 23 '26 06:06

Don


1 Answers

SELECT  *
FROM    workspace
WHERE   CONTAINS(WorkspaceName, '"red*" OR "blue*"')
like image 148
Quassnoi Avatar answered Jun 25 '26 19:06

Quassnoi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!