[nSLUG] MySQL find/replace

Herb htheriault at gmail.com
Sat Jun 26 19:14:25 ADT 2010

Hi all,

I'm migrating an aging drupal site to wordpress and am stuck on one of
my last sql tasks, involving replacing a field in one of the mysql

mysql> update wp_postmeta set meta_key = replace(meta_key,"NULL","my
replacement text");
Query OK, 0 rows affected (0.00 sec)
Rows matched: 549  Changed: 0  Warnings: 0

It's matching the entire column instead of the fields that are NULL

Attempts at changing the first bracketed field to NULL as well
("NULL","NULL","my replacement text") actually fills the column with
the replacement.

Can anyone shed some light on what I'm missing?



More information about the nSLUG mailing list