11 April 2010

Replacing MySQL characters

The following MySQL query will replace all occurences of Ã§ in the column 'name' of the 'customers' table with ç

UPDATE customers SET name = replace(name,'ç','ç');

I found it useful especially after copying databases. Copying databases with different collations tend to screw up the characters (especially when working with French accents). So applying this query will fix things up.

This is also useful in many other situations where we will want to replace a character in the database. I leave it to you to think it out.

No comments:

Post a Comment