By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,462 Members | 1,126 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,462 IT Pros & Developers. It's quick & easy.

how to check case for username password field in table?

nirmalsingh
100+
P: 218
hai all,
in a table user master i have username:Admin , password:admin and userid:1

i have to retrieve user id where username='Admin' and password:'admin'

if i enter username='admin' and password:'Admin' (check case for field value)
the user id should not retrieved.
how to write a simple query for this?

thanx in advance
with Regards
Nirmal.
Feb 23 '08 #1
Share this Question
Share on Google+
1 Reply


P: 23
You can do something like

Expand|Select|Wrap|Line Numbers
  1. SELECT *
  2. FROM users
  3. WHERE 
  4. BINARY_CHECKSUM(username) = BINARY_CHECKSUM('username') AND 
  5. BINARY_CHECKSUM([passwd) = BINARY_CHECKSUM('password')
  6.  
You can leave the " username = 'username' and passwd = 'password' " in the where clause to cover the *extremely* unlikely event that two different usernames and passwords (used in the same record) return the same checksum...
Feb 23 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.