Helpmonks Logo

Removing line breaks and tabs in a MySQL column

Removing line breaks and tabs in a MySQL column

Sometimes it happens that you have unwanted tabs, line breaks, paragraphs, etc. in a table column. With the following code snippet you can clean the value of the column quickly:

[sql]update mytable
set mycolumn = REPLACE(REPLACE(REPLACE(mycolumn, ‘t’, ”), ‘r’, ”), ‘n’, ”)[/sql]

Nitai

Nitai

Founder & CEO of Helpmonks. Serial Entrepreneur. Getting things done.