Does the MySQL TRIM function not trim line breaks or carriage returns?

后端 未结 10 1810
旧时难觅i
旧时难觅i 2020-12-03 13:58

From my experiments, it does not appear to do so. If this is indeed true, what is the best method for removing line breaks? I\'m currently experimenting with the parameters

10条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-03 14:04

    I faced the same issue with one of the fields. There is no perfect solution. In my case i was lucky that the length of the field was supposed to be 6. So i used a query like

    update events set eventuniqueid = substring(eventuniqueid, 1, 6) where length(eventuniqueid) = 7;
    

    You will just have to choose the best option based on your need. The replace '\n' and '\r\n' did not work for me and just ended up wasting my time.

提交回复
热议问题