What would be a sql query to remove \n\r from the text?

后端 未结 7 1780
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-17 15:13

I am using MySQL. My data has a column called text, which uses the TEXT data type.

There are several newlines for each record in this column. I want to

7条回答
  •  Happy的楠姐
    2020-12-17 15:39

    Given suggestion i.e. REPLACE(REPLACE(DBField, '\n', ''), '\r', '') won't work if there are invisible html code like \n \r. For that you have to use char code.

    Example:

    REPLACE(REPLACE(REPLACE(DBField, CHAR(10), ''), CHAR(13), ''), CHAR(9), '')
    

提交回复
热议问题