Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2001
    Location
    india
    Posts
    1

    Lightbulb Unanswered: need a small help on SQL Query.

    guys i need a small help on SQL Query.

    I want to write a SELECT query which gives me CASE SENSITIVE search result. for ex: if a users original password in db is 'TOM' and user while logging in enters his password as 'tom', he should not be able to login ..But if he enters the password as 'TOM' he is permitted to log in .. How do i check this using a SQL Select Query ???
    Any idea on this would be greatly appreciated..

    Nimesh

  2. #2
    Join Date
    Dec 2001
    Location
    Toronto, Canada
    Posts
    335
    Using the PUBS database as an example, I have SQL Server installed as case insensitive. I can write a query to return the Author 'Green' from the AUTHORS table as:

    select *
    from authors
    where au_lname = 'green'

    Which would return 1 record even if the lastname is 'Green' with a capital letter. However if I want to enforce case sensitive I would convert the values to VARBINARY. The following would not return a record:

    select *
    from authors
    where convert(varbinary,au_lname) = convert(varbinary,'green')

    However this would return 1 record:

    select *
    from authors
    where convert(varbinary,au_lname) = convert(varbinary,'Green')

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •