How to put zeros after the digitizer digit - sql server

-1

I need to put 9 zeros after 02:

  

0207200000053P 02- here are the zeros - 07200000053P

that is coming from a variable called @vNossoNumero . How do I do this?

Variable

Select  @vNossoNumero   = case when @Conta='0000064-7' then '16' else '02' end+RIGHT('00000000000' + convert(varchar,convert(bigint,@vSequencia) + 1),11)
    
asked by anonymous 28.08.2018 / 15:46

1 answer

1

I think the solution goes through something like this:

SELECT LEFT(@vNossoNumero, 2) + REPLICATE('0', 9) + RIGHT(@vNossoNumero, LEN(@vNossoNumero) - 2)

Or so:

SELECT SUBSTRING(@vNossoNumero, 1, 2) + REPLICATE('0', 9) + SUBSTRING(@vNossoNumero, 3, LEN(@vNossoNumero))

In both cases the series result, for example:

  

0200000000007200000053P

    
28.08.2018 / 16:10