create function get_static_str(@num int, @size int)
returns varchar(250)
begin
declare @i int
declare @newNum varchar(250)
declare @oldNum varchar(250)
set @i = 0
set @oldNum = cast(@num as varchar(250))
set @newNum = ''
while(@i < @size - len(@oldNum))
begin
set @newNum = @newNum + '0'
set @i = @i + 1
end
set @newNum = @newNum + @oldNum
return @newNum
end
--실행방법
select BoardSample.dbo.get_static_str(1234,7)
댓글 영역