Remove trailing newlines from database fields


/ Published in: SQL
Save to your folder(s)

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.


Copy this code and paste it in your HTML
  1. UPDATE TABLENAME SET COLUMNNAME = REPLACE(COLUMNNAME, '\r', '');

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.