Reputation: 1096
The statement
SELECT * FROM table WHERE some_field IN ('abc', 'def', 'ghi')
ignores case, so records are also found when some_field is 'ABC' for example.
Placing a COLLATE
after the list unfortunately produces a syntax error. Does anyone know how to compare an IN
list case sensitive without changing the (insensitive) collation setting for the DB or single field?
Upvotes: 1
Views: 84
Reputation: 176124
You need to use COLLATE
after column name:
SELECT * FROM table
WHERE some_field COLLATE <collation_name>_CS IN ('abc', 'def', 'ghi');
Upvotes: 2