mysql字符串中出现\r\n导致转换异常
1、针对上述问题字段在mysql数据库中进行查询,如下语句
select * from tablesA where cola like CONCAT('%',char(10),'%');
即可查询test表中info字段中包含换行符的数据有哪些;
2、将包含的换行符去除,执行以下语句即可
update tablesA
set cola = replace(replace(cola,char(10),''),char(13),'')
where cola like concat('%',char(10),'%');
3、除了针对换行符\r\n外,针对\t tab制表位,可采用以下语句
select * from tablesA where cola like CONCAT('%\t%');
update tablesA
set cola = replace(cola,'\t','')
where cola like concat('%',char(10),'%');