<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>has_many :thoughts: MySQL find/replace</title>
    <link>http://blog.kineticweb.com/articles/2007/05/10/mysql-find-replace</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>Musings from a Ruby on Rails development team</description>
    <item>
      <title>MySQL find/replace</title>
      <description>&lt;p&gt;&lt;strong&gt;&lt;span class="caps"&gt;NEAT&lt;/span&gt;!&lt;/strong&gt;&lt;/p&gt;


	&lt;p&gt;I just discovered (thanks Google!) that you can do find/replace within strings inside a MySQL table. In this case, I had to push a website live that contained product descriptions in which the client had referenced the development site &lt;span class="caps"&gt;URL&lt;/span&gt;. So:&lt;/p&gt;


&lt;code&gt;
update products set description = replace(description, 'beta.', 'www.'); 
&lt;/code&gt;

	&lt;p&gt;Worked like a charm. I was about to do a &lt;code&gt;mysqldump&lt;/code&gt; and do something with &lt;code&gt;sed&lt;/code&gt; and &lt;code&gt;grep&lt;/code&gt; and then have to re-import the table. But this worked great.&lt;/p&gt;</description>
      <pubDate>Thu, 10 May 2007 16:35:00 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:0a339071-773d-484b-8acb-cedfdf23b0d4</guid>
      <author>Colin A. Bartlett</author>
      <link>http://blog.kineticweb.com/articles/2007/05/10/mysql-find-replace</link>
      <category>MySQL</category>
    </item>
  </channel>
</rss>
