The MySQL replace syntax is pretty simple to use. For example, let’s say using wordpress and you would like to replace all post titles with ‘2013-2014’ to ‘2014-2015’ (excluding quotes in both cases) the, you can simply use the following SQL syntax:
UPDATE wp_posts SET post_title = REPLACE(post_title,’2013-2014′,’2014-2015′)
More examples, such as searching and replacing text in the post_content column
UPDATE wp_posts SET post_content = REPLACE(post_content,”width:500px; height:500px;”,”width:740px; height:900px;”)
UPDATE wp_posts SET post_content = REPLACE(post_content,’text\’>www.’,’text\’>http://www.’)
Advertisements
Leave a Reply