Answer the question
In order to leave comments, you need to log in
Why doesn't LIKE work when searching in a database?
Please, prompt:
The program with basis on MSSQL has got in inheritance. But my predecessor messed up something with the encoding and it doesn’t work to select by field via LIKE or by hard comparison.
In MSSQLMS everything is displayed normally, not krakozyabry
The strangest thing is that sometimes there is a record that does not contain the desired expression.
COLLATION of the database: SQL_Latin1_General_CP1_CI_AS
Server COLLATION: Cyrillic_General_CI_AS (I suspect, just because of the mismatch with the collation of the database)
COLLATION for the field by which I choose: database default
Tried
SELECT *
FROM table
WHERE comment LIKE '%к%'
SELECT *
FROM table
WHERE comment LIKE '%к%' COLLATE SQL_Latin1_General_CP1_CI_AS
SELECT *
FROM table
WHERE comment LIKE '%к%' COLLATE Cyrillic_General_CI_AS
Answer the question
In order to leave comments, you need to log in
You can read about Collate here .
Assuming that your letter "k" is Russian and there are rows with such a letter in the table, it remains only to sin on setting the client's code page.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question