Sometimes you need to search your database case-sensitive.
But: Microsoft SQL Server is usually configured to be case-INsensitive.
But there’s no need to reconfigure the whole database, here are my 2 favorites to lookup data:
- cast column-value and searchterm to varbinary
(e.g: CAST(ColName AS varbinary(4)) = CAST(‘andy’ AS varbinary(4))
- use COLLATE
(e.g: ColName = ‘andy’ COLLATE SQL_Latin1_General_CP1_CS_AS)
Both should work for SQL Server 2005 and above.
Interested in more options? Have look at this site!