Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Forcing exact case at query level

Author  Topic 

KHeon
Posting Yak Master

135 Posts

Posted - 2002-10-11 : 09:39:32
Hello!

Is there a way to enforce exact case matching when querying SQL Server without having to change the case-sensitivity on the server?

I want to ensure that a user name and password supplied match even at the case level, much like NT/2000 does for user accounts.

For instance:
username - kheon
password - pass

Supplied in login form:
username - kheon
password - pass
result - success

Supplied in login form:
username - KHeon
password - Pass
result - failure

Is there a built-in function I can use to do this?

Thanks in advance!

Kyle Heon
PixelMEDIA, Inc.
Senior Application Programmer, MCP
kheon@pixelmedia.com

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2002-10-11 : 09:44:03
If you convert to a varbinary you should be able to specify an exact match ...


select 'match'
from <yourtable>
where
convert(varbinary,username) = convert(varbinary,@username) and
convert(varbinary,password) = convert(varbinary,@password)

 


Jay White
{0}
Go to Top of Page

KHeon
Posting Yak Master

135 Posts

Posted - 2002-10-11 : 09:53:01
Page47 -

Thanks, that appears to do the trick. I have hashed passwords in the database so I'll have to do some editing to my sprocs to ensure that everything works but a quick test appears to work fine.

Thanks again!

Kyle Heon
PixelMEDIA, Inc.
Senior Application Programmer, MCP
kheon@pixelmedia.com
Go to Top of Page
   

- Advertisement -