Home » MySQL » MySQL REPLACE Function

Just a quick reminder and example to myself really for this useful MySQL string function.

Syntax:

REPLACE( table_field, search, replace)

Example (replaces all instances of donkey with horse:

UPDATE `table` SET `table_field` = REPLACE( `table_field`, 'donkey', 'horse')

Leave a Reply

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>