Christoffer Kjølbæk I have a blog, therefore I am…

8Nov/090

Search and replace in MySQL

Howto replace foo with bar in the column col_name of all records of table table_name, where col_name has foo in it.

UPDATE table_name
SET col_name = (REPLACE (col_name, 'foo', 'bar'))
WHERE col_name LIKE '%foo%';

Kommentarer (0) Trackbacks (0)

Ingen kommentarer endnu.


Læg en kommentar


Ingen trackbacks endnu.