Solved

Replacing a word in a MySQL table

Posted on 2011-02-17
3
293 Views
Last Modified: 2012-06-27
I've got a table in a MySQL database and I need to replace a word in one particular column. I'm using the code below and it didn't work. What am I missing?

update [news] set [main_body] = replace([main_body],'[Colgate]','[Texaco]');
0
Comment
Question by:brucegust
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 3

Expert Comment

by:thecrew
ID: 34919709
Get rid of the square brackets?
0
 
LVL 3

Accepted Solution

by:
thecrew earned 250 total points
ID: 34919779
Actually I'm certain, I don't know why I used a question mark. Remove those brackets!
:)
0
 
LVL 34

Assisted Solution

by:Beverley Portlock
Beverley Portlock earned 250 total points
ID: 34919801
Try

UPDATE news SET main_body = REPLACE( main_body, 'Colgate', 'Texaco' )

See http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_replace for more info
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A company’s centralized system that manages user data, security, and distributed resources is often a focus of criminal attention. Active Directory (AD) is no exception. In truth, it’s even more likely to be targeted due to the number of companies …
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question