SQL Server 加前导0

declare @a int
declare @b int
set @a = 1 --需要显示的数字
set @b = 3 --显示位数
select right(cast(power(10,@b) as varchar)+@a,@b)

原文地址:https://www.cnblogs.com/dcrenl/p/4041150.html