0

Let's say I have table NamesTable, which has text index on Name column

DECLARE @String2 NVARCHAR(20) = '"SomeName''*"'
SELECT * FROM NamesTable
WHERE CONTAINS(Name, @String2)

What does single quote in CONTAINS string mean? Why is it ignored?

2
  • Looks like it's all symbols, in general, which are ignored. Jan 6, 2015 at 10:27
  • What were you expecting to find? The string you are searching for is SomeName'* which I would expect to simply become SomeName. This is because ' separates the * from the word and does not become a wildcard such as SomeName*.
    – RLF
    Jan 6, 2015 at 16:11

1 Answer 1

2

CONTAINS is used for full-text searching, and can search for:

  • for a word or phrase
  • the prefix of a word or phrase
  • a word near another word
  • a word inflectionally generated from another word, such as spoon and spooning
  • synonyms

Perhaps you should use:

DECLARE @String2 NVARCHAR(20) = '"SomeName''%"';
SELECT * 
FROM dbo.NamesTable NT
WHERE NT.Name LIKE @String2;

Not the answer you're looking for? Browse other questions tagged or ask your own question.