Search memo field using space-separated keywords?
given the following test records
ID, MemoField
1, "apples oranges mangoes peaches"
2, "oranges bananas apples"
3, "oranges plums cherries"
4, "bananas cherries kiwi"
and having keywords entered in a single text field as: "apples oranges"
I want to be able to return records 1, 2 and 3 because those recor开发者_运维问答ds either contain apples or oranges....
I want to assume that spaces in the list of keywords imply an OR.
How can I write a safe, parameterized query to make this happen? I was thinking of taking the keywords, splitting them and generating clauses for each of the words and OR-ing them, but that doesn't seem efficient especially as the list of keywords get longer....
I'm really at a loss, please help.
Thanks, Lou
I found SQL Server Full-Text and the FREETEXT function. Hopefully this works out.
Thanks, M
精彩评论