The solution to avoid Arithmetic overflow error converting expression is to use a bigger data type. The solution to avoid this arithmetic overflow error is to change the data type from INT to BIGINT or DECIMAL(11,0) for example.
You need to increase the width of the variable to store this number e.g. making @sample NUMERIC (6,2) will solve this error.
1. "Arithmetic overflow error converting IDENTITY to data type int" error means the value of IDENTITY is overflowing range of data type of that particular column. 2. Check the current value of Identity.
Try converting it before summing. eg.
SELECT SUM(CONVERT(bigint, columnname)) FROM tablename
or
SELECT SUM(CAST(columnname AS BIGINT)) FROM tablename
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With