Perform a Mass MySQL Find and Replace in a Single Query

September 23rd, 2010 - Posted by Steve Marks to MySQL, Web Development.

If you haven’t heard of the MySQL REPLACE() function before then add it to your toolkit because I’m pretty confident you’ll need it again at some point. It’s saved my a** numerous times now and saved me hours of manual work.

For those of you reading this that are familiar with programming it’s the MySQL equivalent of PHP’s str_replace() and JavaScript’s replace() functions and it’s format goes something like this:

    `[dest_field_name]` = replace(`[source_field_name]`, '[string_to_find]', '[string_to_replace]');
This entry was posted on Thursday, September 23rd, 2010 at 7:49 pm by +Steve Marks and is filed under MySQL, Web Development. You can follow any responses to this entry through the RSS 2.0 feed.

Fear not, we won't publish this

Comments (0)

No comments have been left yet. Be the first