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
case-insensitive:

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 http://forge.mysql.com/tools/tool.php?id=135 .

-- 
        Dan Nelson
        dnel...@allantgroup.com

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql

Reply via email to