Issue
I have a mysql table with VARCHAR column which contains String values. Sometimes at the end of the string there is a carriage return (\r). I only want to delete the \r at the end of the string if it exists.
Solution
A carriage return is CHAR(13)
The following code will remove Carriage return
UPDATE table_name set column_name=REPLACE(column_name,char(13),'')
I have a mysql table with VARCHAR column which contains String values. Sometimes at the end of the string there is a carriage return (\r). I only want to delete the \r at the end of the string if it exists.
Solution
A carriage return is CHAR(13)
The following code will remove Carriage return
UPDATE table_name set column_name=REPLACE(column_name,char(13),'')