1、如device表中的identity字段正常的字段长度是32位,但是某些不正常的数据,后面多出空格,需要去掉后面的空格,可执行以下命令:

1 select * from device where length(identity)=33;
2 update device set identity=trim(identity) where length(identity)=33;

2、使用substring函数截取某字段的的其中一部分的方法,如截取identity第21位及其之后的数据,并保存位identity12字段:

SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。
1 update device set identity12=substring(identity,21);

 

扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄