select RIGHT(GZL,7),gzl FROM zxfqdhz
从右边开始截取
select RIGHT( replace(replace(khjx,'-',''), '/',''),7),khjx FROM zxfqdhz
去除一些特殊字符
SELECT stuff('00000000',1,len(RIGHT( replace(replace(khjx,'-',''), '/',''),7) ),'')+CONVERT(varchar(50),RIGHT( replace(replace(khjx,'-',''), '/',''),7)) FROM zxfqdhz
用0补足位数