Reputation: 666
I am executing the following SQL statement on an indexed SQL Server 2008 R2 database.
SELECT * FROM mydatabase WHERE (CONTAINS(ColumnA,'"The Apple is red"'))
The problem is that it returns too many entries. It also returns entries where 'ColumnA' contains only one of the words ('Apple' or 'is' or 'red'...) and not only the entries which contains the exact phrase.
According to MSDN this should be the way to search for a phrase.
Thanks cpt.oneeye
Upvotes: 1
Views: 66
Reputation: 2425
SELECT * FROM mydatabase WHERE ColumnA = 'The Apple is red'
or
Select * FROM mydatabase WHERE ColumnA LIKE '%The Apple is red%'
The % says that there might be something different before or after the expression. If that is not the case or you dont want these to be selected, you can use the first one.
Upvotes: 0
Reputation: 172378
You may try like this(Remove the double quotes ""
):-
SELECT * FROM mydatabase WHERE (CONTAINS(ColumnA,'The Apple is red'))
The similar issue was there at MSDN site example
Upvotes: 1