sbaby3
sbaby3

Reputation: 1

How to make SQL search case sensitive?

my WHERE statement returns everything that starts with an A to H whether it is capital or lowercase. I have tried to use COLLATE Latin1_General_CS_AS, but I get "collation "latin1_general_cs_as" for encoding "UTF8" does not exist". The simplified query is below.

SELECT Move
FROM Moves
WHERE Move BETWEEN 'a' AND 'h';

Upvotes: 0

Views: 166

Answers (1)

user330315
user330315

Reputation:

It seems the BETWEEN clause can't make use of the collate option, so you will need to rewrite it to use >= and <= explicitly

SELECT Move
FROM Moves
WHERE Move >= 'a' collate "C"  
  AND move <= 'h' collate "C"
;

Upvotes: 2

Related Questions