When using a case-insensitive Server Collation your sql queries are case-insensitive by default. To write a case-sensitive MS-SQL query, you need to add the



SELECT ID, Name FROM Testdatabase.dbo.NAMES WHERE [Name] COLLATE Latin1_General_CS_AS = 'JOHN DOE'

In this sample we used the Latin1_General_CI_AS Server Collation, thats why we COLLATE Latin1_General_CS_AS. You should use the corresponding CS Server Collation of the one you are using.

How to write a case-sensitive MS-SQL query using the Collate Keyword

The _CS_ in the Server Collation Name stands for case-sensitive while _CI_ stands for case-insensitiv

see also Server Collation , COLLATE (Transact-SQL)

Leave a Reply