SQL Server queries case sensitivity

Gold picture Gold · Aug 2, 2010 · Viewed 46.1k times · Source

I have this database:

abcDEF

ABCdef

abcdef

if I write: select * from MyTbl where A='ABCdef'

how to get: ABCdef

and how to get:

abcDEF

    ABCdef

    abcdef

Thanks in advance

forgot to write - sqlCE

Answer

D'Arcy Rittich picture D'Arcy Rittich · Aug 2, 2010

You can make your query case sensitive by making use of the COLLATE keyword.

SELECT A 
FROM MyTbl 
WHERE A COLLATE Latin1_General_CS_AS = 'ABCdef'