Use REPLACE. This drops all carriage returns and line-feeds:

 SELECT REPLACE(REPLACE(log, '\r', ''), '\n', '') FROM test;

Couple with UPDATE to actually change the existing data:

 UPDATE test SET log = REPLACE(REPLACE(log, '\r', ''), '\n', '');

If you only want to drop trailing carriage returns and
line-feeds, you can use TRIM instead:

 SELECT TRIM(TRAILING '\r\n' FROM log) FROM test;

See "String Functions" in the manual:

http://dev.mysql.com/doc/mysql/en/string-functions.html

____________________________________________________________
Eamon Daly



----- Original Message ----- From: "Dan Bolser" <[EMAIL PROTECTED]>
To: <mysql@lists.mysql.com>
Sent: Friday, April 15, 2005 11:46 AM
Subject: remove newline hack?




How to remove newlines from a column? Data is given me in binary format.

If I dump should I set some new record terminator, parse out newlines and
reload?

Any beter hack?

Dan.


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]




--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to