Posted By

powerthru on 10/13/10


Tagged

mysql trim trailing newline


Versions (?)

Remove trailing newlines from database fields


 / Published in: SQL
 

sometimes we botch an import, and end up with return or newline characters in the field. So fields which should be empty have \r in them, or fields with text data have an invisible trailing newline. This makes it impossible to match the text values. This sql statement removes the \r characters in a field.

  1. UPDATE TABLENAME SET COLUMNNAME = REPLACE(COLUMNNAME, '\r', '');

Report this snippet  

You need to login to post a comment.