Posted by: prajapatinilesh | December 12, 2007

Find and Replace with MySql

As exemplified below, MySQL has a very useful function for finding and replacing data.

update [table_name] set [field_name] = replace([field_name], ‘[search_data]’, ‘[replace_data]’);

A real-world example would look something like this:

update page set content = replace(content, ‘http://kk.com’, ‘http://www.kk.com’);

Advertisements

Responses

  1. where do I run this command? do I have to login to mysql database and run querry


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: