List:General Discussion« Previous MessageNext Message »
From:Sasha Pachev Date:April 26 1999 8:15pm
Subject:Re: Selects with case sensitivity
View as plain text  
Barry wrote:
> Hello All,
> I am a semi-newbie so this should be a super easy one. I am doing a simple
> authorization db for our web server. As a test I created the following db.
> Auth
>   User  char(32)
>   Pwd   char(16)
> and entered the following
>   User     Pwd
>   Barry    Sch
> if I do the any of the following in the utility myAdmin
>   Select * from Auth where User='Barry' and Pwd='Sch'
>   Select * from Auth where User='barry' and Pwd='scH'
>   Select * from Auth where User='BARRY' and Pwd='sCh'
> it returns the Barry Sch row shown above.
> I would like to do a Select where User is not case sensitive, but where Pwd
> is case sensitive. Searching the manual I came up with:
>   Select * from Auth where User='barry' and strcmp(Pwd,'Sch')=0
> It does what I want. Is this the best way?
> Thanks,
> Barry.

There is an alternative way, I do not now if it is any
better. Make your data type blob instead of char, and
then = operator will be case-insensitive.

Sasha Pachev (home) (work)
Looking for ISP that provides MySQLChristopher R. Jones26 Apr
  • Re: Looking for ISP that provides MySQLBill Gerrard26 Apr
  • Re: Looking for ISP that provides MySQLBill Rhodes26 Apr
    • Selects with case sensitivityBarry26 Apr
    • Re: Looking for ISP that provides MySQLChris Jester27 Apr
    • Re: Looking for ISP that provides MySQLKyle Cordes27 Apr
      • Re: Looking for ISP that provides MySQLJohn Elliott27 Apr
  • Re: Selects with case sensitivitySasha Pachev27 Apr
    • Re: Selects with case sensitivityThimble Smith27 Apr
      • Problems with BINARY keywordRichard Antecki28 Apr
        • Re: Problems with BINARY keywordFred Read28 Apr
        • Re: Problems with BINARY keywordVladimir Berezniker29 Apr
        • Problems with BINARY keywordMichael Widenius11 May
    • Re: Selects with case sensitivityMartin Ramsch27 Apr
      • Re: Selects with - ThanksBarry27 Apr