I have the variable @numero1
which has the following result:
020000000000720000018
But at the time of the update it gives the error:
SQL Server String or binary data would be truncated
declare @g1 varchar(50)
declare @numero1 varchar(50)
set @g1 = SUBSTRING(@vNossoNumero, 1, 2) + REPLICATE('0', 9) +
SUBSTRING(@vNossoNumero, 3, LEN(@vNossoNumero))
set @numero1 = left(@g1,Max(LEN(@g1))-2)
print @numero1 // - dá erro nessa variável
update DUPLICATA set DupNossoNumBco=@numero1 where DupNum=(
select ParcDocFinDupNum from PARC_DOC_FIN
where EMPCOD = @EMPCOD
AND DOCFINCHV = @DOCFINCHV
AND PARCDOCFINSEQ = @PARCDOCFINSEQ
AND PARCDOCFINDESMPAG = @PARCDOCFINDESMPAG
)
END