左填充

来源:互联网 发布:魔方公寓上海知乎 编辑:程序博客网 时间:2024/04/23 17:41
declare @t table(id int identity(1,1),col varchar(10))insert into @t (col) select 'a'unionselect 'b'unionselect 'c'select * from @tselect REPLICATE('0',4-len(id))+cast(id as varchar),col from @t


0 0