Go Back   SZONE.US Forums > Do it yourself (DIY) > Web Tips

Web Tips Tips and tricks specializing in programming languages of the web. ie. PHP, MYSQL, XHTML, CSS, etc

Search and Replace MYSQL

Views:3430
Reply
Thread Tools Search this Thread Rate Thread
  #1  
Unread 09.12.07, 09:33 AM
Zachariah Boren's Avatar
Zachariah Boren Zachariah Boren is offline
Administrator
 
Join Date: 02.07
Location: Canoga Park, CA
Posts: 928
Blog Entries: 6
Images: 10075
Send a message via ICQ to Zachariah Boren Send a message via MSN to Zachariah Boren Send a message via twitter to Zachariah Boren
Search and Replace MYSQL

Here is a little trick that saved a lot of time.
I had to search and replace a string of text in a column of data.

Tested:
mySQL 4.x,5.x

Code:
update TABLE set COLUMN = replace(COLUMN, 'OLD_VALUE', 'NEW_VALUE');
EX:
Table: CRAYONS
Column: COLOR
Search: Red
Replace: Green
Code:
update CRAYONS set COLOR = replace(COLOR, 'Red', 'Green');
Hope it helps.
__________________
http://www.szone.us | http://www.gzhq.net
Twitter | Facebook | My:Hacks @ vBulletin.org
Member of Kiwanis Club of Chatsworth
Reply With Quote
Reply

Tags
mysql, replace, search

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:


Similar Threads
Thread Thread Starter Forum Replies Last Post
Veteran Astronauts Available to Discuss Search for 2009 Class @NASA N.A.S.A. 0 05.01.08 04:05 PM
NASA Mission Finds New Clues to Guide the Search for Life on Mars @NASA N.A.S.A. 0 03.20.08 11:36 AM
NASA Teleconference to Replace Televised Dawn Mission Briefing @NASA N.A.S.A. 0 06.25.07 04:18 PM


All times are GMT -8. The time now is 09:21 PM.


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Copyright 2007 - 20017 SZONE.US All rights reserved