Case-sensitive / Case-Insensitive

greenspun.com : LUSENET : SQL Server Database Administration : One Thread

SQL 7 allows data to be stored case-insensitive; when i search i don't have to use uppers or downers everywhere.

however, for usernames and passwords, is there a way to FORCE a case-sensitive comparison?

------- SELECT * FROM Users WHERE Username = "some_value" AND Password = "some_other_value" -------

-- Anonymous, July 21, 1999

Answers

John,

Before doing a comparison, convert each of the operands to binary.

For instance:

if ('Aa' = 'aa') print 'True' else print 'False'

prints True, whereas:

if (convert (binary, 'Aa') = convert (binary, 'aa')) print 'True' else print 'False'

prints False.

Hope this helps,

Eric

-- Anonymous, July 28, 1999


Moderation questions? read the FAQ