34,837
社区成员




还有这种方法:
declare @table table(id varchar(10))
insert into @table
select '1245'
union all
select '45?1'
union
select '9?11'
----
select replace(id,left(id,1),'0') as id from @table
/*
id
-----
0245
05?1
0?11
*/
update a
set id=stuff(id,1,1,'0')
update a
set id=stuff(id,1,1,'0')
update a
set id='0'+right(id,len(id)-1)
update a
set id='0'+substring(id,2,8000)