1. 程式人生 > >填充和擷取某一欄位的值

填充和擷取某一欄位的值

取某一欄位的後幾位和將某一欄位填充為指定長定
insert into #aa(code,[name])
select '1','sssssssssssss'

insert into #aa(code,[name])
select '2','sssssssssssss'
union all
select '3','gsssss'
insert into #aa(code,[name])
select '14','as'

update #aa
set [name] = right([name],3),
code = right( '000' + isnull(code,''),3)


select * from #aa

drop table #aa