how to check case for username password field in table?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nirmalsingh
    New Member
    • Sep 2006
    • 218

    how to check case for username password field in table?

    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.
  • jagged
    New Member
    • Feb 2008
    • 23

    #2
    You can do something like

    Code:
    SELECT *
    FROM users
    WHERE 
    BINARY_CHECKSUM(username) = BINARY_CHECKSUM('username') AND 
    BINARY_CHECKSUM([passwd) = BINARY_CHECKSUM('password')
    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...

    Comment

    Working...