Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

share|improve this question
    
stackoverflow.com/questions/421227/… –  Milo May 25 '11 at 18:51

1 Answer 1

up vote 0 down vote accepted

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.

share|improve this answer
    
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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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