Wednesday, May 14, 2008

SQL Updating certain pattern of text in MySQL

There are a way to update a text in some database with certain pattern. Today I get a case regarding this problem. In order to update a content in a column of a table, you can use the following command:

mysql> update bodycontent SET body = REPLACE ( `body` ,'google.com','arie.ganten
g.com');

The above query will update table bodycontent, body column which content is google.com, to arie.ganteng.com.

No comments: