Ver originalSELECT replicate('0',8-len(Doc_NumUltimo)) + CONVERT(VARCHAR(20),Doc_NumUltimo+1) FROM dbo.Serie_Maximo_Correlativo WHERE Num_Serie='004'