SQL 自動补位
declare @intNumber int, @strNumber varchar(5), @intLen int
select @intNumber = 12
select @intLen = 5
select @strNumber = convert(varchar(5), @intNumber)
select replicate('0' , @intLen - len(@strNumber)) + @strNumber
SQL 自動补位
declare @intNumber int, @strNumber varchar(5), @intLen int
select @intNumber = 12
select @intLen = 5
select @strNumber = convert(varchar(5), @intNumber)
select replicate('0' , @intLen - len(@strNumber)) + @strNumber