Wednesday, February 11, 2009

[Query] Case-sensitive query on a case-insensitive server

SQL Collations play an important role in queries - if you're lucky enough to have a case-insensitive server (which many are; it's the default), then you are saved from having to make sure EveryThing Is Capitalized just Right.

However, there are times when you need it.

FROM dbo.CaseSensitiveTest
WHERE Value1 LIKE '%Test%' Collate

That will give you only the values that are capitalized like "Test" is.

No comments: