方法1:
SQL 语句格式如下:
select replace(ltrim(replace(字段,'0',' ')),' ','0') FROM 表
实例1:
select replace(ltrim(replace('000004564972000','0',' ')),' ','0')
去掉右边的0:
select replace(Rtrim(replace('000004564972000','0',' ')),' ','0')
方法2:
SELECT stuff(substring('000004564972000',0,80),1,patindex('%[^0]%',substring('000004564972000',0,80))-1,''),
substring('000004564972000',0,80),patindex('%[^0]%',substring('000004564972000',0,80))-1