Search code examples
mysqlmysql-real-escape-string

Mysql remove stored escape character


Due to a coding error by a prior dev I've discovered we have a mysql table that has a bit of data that has an extra escape character.

update mytable SET title = TRIM(TRAILING '\' FROM title)

I've tried the above but it obviously throws an error, and I've tried '\\'. How do I get mysql to treat the backslash literally on it's own?


Solution

  • Try the following:

    update mytable SET title = TRIM(TRAILING '\\' FROM title)