I'm familiar with this method...

update TABLE_NAME set FIELD_NAME = replace(FIELD_NAME, ‘find this string’, ‘replace found string with this string’);

The problem is, I'm trying to do this to all tables (or select tables), but need the replace to hit all columns for the table in question. Currently, the only way I've found for a table with 20 columns is to repeat this query 20 times. Once for each column.

Is there any way to simply apply the search replace on the table rather than column?


Have you tried the search and replace plugin? it will allow you to select particular tables: http://wordpress.org/extend/plugins/search-and-replace/

Of course use it with caution. etc.

  • Well, there's legacy tables from an older corporate database. So in short, this data doesn't necessarily live in only wp_***** tables. That's why I was looking for a way to do it with a query. – Will Ashworth May 25 '11 at 18:48
  • 1
    ah sorry. then your question maybe better suited in superuser.com or even better Database administrators: dba.stackexchange.com – chrisjlee May 25 '11 at 18:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.