i want increase number concatenating value.
for ex:
declare @i int select @i =1 select right('000' + convert(varchar(3),@i),3) output : 001
if @i value increases 1005
then output should be: 1005
i know can increase number '0000' , want start 3 digits if @i value reach 1000 i want in 4 digits 1000,1001,1002...
is there way this.. in advance.
select case when @i < 1000 right('000' + convert(varchar(3),@i),3) else convert(varchar(4),@i) end /* case */
Comments
Post a Comment