here its my escenario i need to get the mas id from a table doing the next query select max(folio+1) as Folio from Folios, then i need to get this Folio and replace in string with a 6 number format example 001111
DECLARE @Tram varchar(800)
SET @Folio = 1111111 the value from above query im put explicit to be understand it, with 6 digits and fill it with 00 to the left in case of the folio its smaller than the format need it
SET @Tram = 'BCI11000010510121438510 0010250000000000001100000000010250000000000000NOW0000000000000000000000000000'
SELECT STUFF(@tram, 31, 6, @Folio) as trama
this return me this
BCI11000010510121438510 1111110000000000001100000000010250000000000000NOW0000000000000000000000000000
but i need this
BCI11000010510121438510 Folio0000000000001100000000010250000000000000NOW0000000000000000000000000000
any one can help me ???
DECLARE @Tram varchar(800)
SET @Folio = 1111111 the value from above query im put explicit to be understand it, with 6 digits and fill it with 00 to the left in case of the folio its smaller than the format need it
SET @Tram = 'BCI11000010510121438510 0010250000000000001100000000010250000000000000NOW0000000000000000000000000000'
SELECT STUFF(@tram, 31, 6, @Folio) as trama
this return me this
BCI11000010510121438510 1111110000000000001100000000010250000000000000NOW0000000000000000000000000000
but i need this
BCI11000010510121438510 Folio0000000000001100000000010250000000000000NOW0000000000000000000000000000
any one can help me ???