How to remove new line characters from data rows in mysql?
update mytable set title=trim(replace(REPLACE(title,CHAR(13),''),CHAR(10),''));
Above is working for fine.
UPDATE test SET log = REPLACE(REPLACE(log, '\r', ''), '\n', '');
worked for me.
while its similar, it'll also get rid of \r\n
http://lists.mysql.com/mysql/182689
your syntax is wrong:
update mytable SET title = TRIM(TRAILING '\n' FROM title)
Addition:
If the newline character is at the start of the field:
update mytable SET title = TRIM(LEADING '\n' FROM title)
1) Replace all new line and tab characters with spaces.
2) Remove all leading and trailing spaces.
UPDATE mytable SET `title` = TRIM(REPLACE(REPLACE(REPLACE(`title`, '\n', ' '), '\r', ' '), '\t', ' '));