我们有时会遇到表里面出现一堆换行符或者回车符的情况,可以使用以下两个小技巧进行快速替换。
1,去除换行符
-- 去除换行符可以使用以下两种方式 update tableName set colName = REPLACE(colName, ‘\n‘, ‘‘); update tableName set colName = REPLACE(colName, char(10), ‘‘);
2,去除回车符
-- 去除换行符可以使用以下两种方式
update tableName set colName = REPLACE(colName, ‘\r‘, ‘‘);
update tableName set colName = REPLACE(colName, char(13), ‘‘);
注:以上方法虽然可以快速替换解决问题,但是对数据库数据的操作还是要非常谨慎,最好是在数据插入前做好处理。
原文:https://www.cnblogs.com/Lily-nercel/p/14860475.html