List:General Discussion« Previous MessageNext Message »
From:Dan Nelson Date:January 17 2012 4:23am
Subject:Re: case insensitivity
View as plain text  
In the last episode (Jan 16), Haluk Karamete said:
> How do I do case insensitive searches and replace operations?  Is there an
> easy way to do this?  Like some sort of a server level setting telling
> mySQL to ignore case for once and for all?

For searches (i.e. comparisons in the WHERE clause), mysql should already be

mysql> show variables like 'collation%';
| Variable_name        | Value             |
| collation_connection | latin1_swedish_ci |
| collation_database   | latin1_swedish_ci |
| collation_server     | latin1_swedish_ci |
3 rows in set (0.00 sec)

The "ci" at the end means string comparisons are case-insensitive.  

If you're talking about the REPLACE() function, that is case-sensitive.  You
can always do REPLACE(LOWER(text),from,to), though, at the expense of having
your result string lowercased on you.  If you need to preserve case, try the
stored function at .

	Dan Nelson
case insensitivityHaluk Karamete17 Jan
  • Re: case insensitivityWilly Mularto17 Jan
    • Re: case insensitivityHaluk Karamete17 Jan
      • Re: case insensitivityhsv18 Jan
  • Re: case insensitivityDan Nelson17 Jan