Monday 7 November 2016

Arithmetic overflow error converting expression to data type int.

Just a quick note to myself, SUMming a column of ints produced a value that exceeded the range of int.
So, I had to convert on the fly.


The Error -

Msg 8115, Level 16, State 2, Line 9
Arithmetic overflow error converting expression to data type int.

The Solution -

SELECT SUM(CONVERT(bigint,myint)) FROM mytable

No comments: