• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 302
  • Last Modified:

Replacing a word in a MySQL table

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
brucegust
Asked:
brucegust
  • 2
2 Solutions
 
thecrewCommented:
Get rid of the square brackets?
0
 
thecrewCommented:
Actually I'm certain, I don't know why I used a question mark. Remove those brackets!
:)
0
 
Beverley PortlockCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Improve Your Query Performance Tuning

In this FREE six-day email course, you'll learn from Janis Griffin, Database Performance Evangelist. She'll teach 12 steps that you can use to optimize your queries as much as possible and see measurable results in your work. Get started today!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now