且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

MySQL从列中删除尾随的换行符

更新时间:2023-02-18 13:01:05

您可以直接在SQL中替换它们,方法是在末尾匹配"\ r",然后替换该"\ r".

You can replace these directly from SQL by matching "\r" at the end, then replacing that "\r".

示例:

UPDATE Person SET firstName = REPLACE(firstName, '\n', '')
where firstName LIKE '%\n'

UPDATE Person SET firstName = REPLACE(firstName, '\r', '')
where firstName LIKE '%\r'