Case-insensitive replace with Mysql
Attention!!! This query will convert all matched records to lowercase, backup first!
UPDATE my_table SET my_text_field = REPLACE( LOWER(my_text_field), 'bad_string', 'good_string') where my_text_field like '%bad_string%'
I tried to replace some spam-like words from a news queue. I tried this sql query above without where clause first. It was a big mistake because all queue converted to lowercase. I already read docs on mysql.man pages. But there is no function for a case-insensitive replace. I am still searching for a solution. Thanks for any help!
Similar entries
- Mysql replace with regexp
- Mysql update table if field exists
- Replace string in big database or large text file
- Howto log slow MySQL Queries in Debian
- Mysql Order / Sort by before Group by
- Backup all MySQL databases automagicly with the PHP admin script
- Mysql auto_increment lower than highest ID
- How to hide / encrypt CCK Email field with JS against spammer
- Fix swfupload fake flash player error
- Import big SQL Files under WAMP or LAMP ?
- Delete all spam node entries of a spesific user on a Drupal site with PHP
- Mysql: update weight by an auto-incremented string created on the fly
- Prevent hotlinking with htaccess and mod_rewrite
- How to use custom function aliases in PHP
- CMS for a nice-looking news website
- Free Web-Hosting with PHP-MYSQL, FTP and no-ads
- Import Dmoz / ODP data to mysql
- #2006 - MySQL server has gone away
- Configure phpMyAdmin to login automagicly without prompted for username and password
- #1045 Cannot log in to the MySQL server (PhpMyAdmin 2.4.8)

I need it to and subscribe! In my example all these words must be replaced with Canada.
CANADA
canada
cAnada
canaDA
...
genius! Thanks!
Post new comment