T-SQL Using the CONTAINS Predicate with Hyphen

Imagine a table (table1) with one column (column1) and one record whose value is roll-over. Then use the following SQL query and you will not get any records.

select * from table1 where contains(column1, ' "roll-over" ') 

Is there a way to avoid a hyphen in the search text? So far I have not succeeded (I tried all subsequent shoots without success).

 select * from table1 where contains(column1, ' "roll\-over" ') select * from table1 where contains(column1, ' "roll!-over" ') select * from table1 where contains(column1, ' "roll[-]over" ') 

Also note that using the LIKE keyword is not possible for my application, because I use full-text search indexing.

+4
source share
1 answer

You don't seem to be able to do this. Read this article:

https://support.microsoft.com/en-us/help/200043/prb-dashes---ignored-in-search-with-sql-full-text-and-msidxs-queries

They offer a search only for alphanumeric values ​​(lame) or use the LIKE clause (not an option for you).

+4
source

All Articles