Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Replacing a word in a MySQL table

Posted on 2011-02-17
3
Medium Priority
?
297 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 1000 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 1000 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

There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
Suggested Courses

610 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