String or binary data would be truncated

hi, I has 2 script run to update the same table.
one script is ok, another script unable to run with error

when I run below script:

update transactionDetail set PrintCount = '1' where TrxDetailID IN ('45652748I85')

Below error is shown:

Msg 8152, Level 16, State 14, Procedure tgIncreasePrintCount, Line 33
String or binary data would be truncated.
The statement has been terminated.

however, when I run below script with same table, same server, there is no problem.

update transactionDetail set PrintCount = '1' where TrxDetailID IN ('45652749I85')

anyone know the reason?
how to solve it?

Do you have triggers on this table?
Take a look of the difference between the to records.

SELECT * 
FROM transactionDetail 
WHERE TrxDetailID IN ('45652749I85' , '45652748I85')

Can you post the entire store procedure and the description of the table ?

as stated in the error message, check that procedure

thanks,
I solved it after I change the datatype in triggers table.

1 Like