If you have a database that has been setup with a case insensitive collation sequence, but you want to retrieve or sort some data in a case sensitive way, you can do it like this:
SELECT *
FROM MyTable
WHERE aField = 'a' COLLATE Latin1_General_CS_AS
or, for sorting:
SELECT *
FROM MyTable
ORDER BY aField COLLATE Latin1_General_CS_AS
As you can see, you just have to define a case sensitive (CS stands for Case Sensitive) collation in your query.
Of course, if you have a table that contains data that should be treated in a case-sensitive way, you can create that table/columns with a case sensitive collation sequence.
Geen opmerkingen:
Een reactie posten