SQL: LIKE and Contains — Different results
sql, sql-server
Solution
`contains` is functionality based on the full text index. It supports words, phrases, and prefixed matches on words, but not suffixed matches. So you can match words that start with `'aprilis'` but not words that end with it or that contain it arbitrarily in the middle. You might be able to take advantage of a thesaurus for these terms.
This is explained in more detail in the documentation.
Problem
I am using MS SQL Express SQL function `Contains` to select data. However when I selected data with LIKE operator, I realised that Contains function is missing a few rows. Rebuilt indexes but it didn't help. Sql: `brs.SearchText like '%aprilis%'` and `CONTAINS(brs.SearchText, '*aprilis*')` The `contains` function missed rows like: ``` 22-28.aprīlis [1.aprīlis] Sīraprīlis ``` PS. If I search directly `CONTAINS(brs.SearchText, '*22-28.aprīlis*')`, then it finds them