Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 300
  • 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

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

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