MySQL – Replace Select Text within a Database Field

Published under MySQL,web development. Tags: .

Maintaining databases can be a chore, but knowing the appropriate SQL to do the job can save hours of time. Here is a tidbit regarding changing a select string of text within a specific field of a table in a MySQL database. You can edit 1000s of records with this one query:
UPDATE table SET field = REPLACE(field, 'text to be replaced', 'replacement text');

In this example, the table name is “table”, the field to find the text in is named “field”, the rest should be self explanatory.

VN:F [1.9.3_1094]
Rating: 4.0/10 (3 votes cast)
VN:F [1.9.3_1094]
Rating: 0 (from 2 votes)
MySQL - Replace Select Text within a Database Field, 4.0 out of 10 based on 3 ratings
 
Take a piece of the Web from WebPaws.com: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • MisterWong
  • Y!GG
  • Webnews
  • Digg
  • del.icio.us
  • StumbleUpon
  • De.lirio.us
  • eKudos
  • email
  • Facebook
  • Fleck
  • Google Bookmarks
  • Hype
  • LinkedIn
  • MySpace
  • Print
  • Technorati
  • YahooMyWeb

No Comments to MySQL – Replace Select Text within a Database Field

Leave a comment to this post


WebPaws.com is Digg proof thanks to caching by WP Super Cache