Mysql remove stored escape character
-
21-06-2021 - |
Question
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)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow