Chris Chris - 7 months ago 35
MySQL Question

Changing forum content tags in string column

In the process on migarting from one forum software to another I have been left with mis-matched embedded BBCodes in hundreds of posts.

For example this is the content of one post:

Luke Kelly - Raglan Road + Lyrics

My new forum expects:

Luke Kelly - Raglan Road + Lyrics

It's beyond my SQL abilities to substitute the tags.

The table name is
and the field name is

Any help would be appreciated, thanks.


Simple UPDATE command with nested replace(string, string, string) would work:

UPDATE xf_post
  message = replace(replace(message, '[video]', '[MEDIA]'),'[/video]','[/MEDIA]'));