Skip to Content
Former Member
Feb 05, 2016 at 05:14 PM

Sum of TINYINT values causes numeric overflow for not null column


Does anyone know why a null column is behaving differently from a not null column when summing values in a calculation view?

In my transaction table I have two record counters type TINYINT with always value 1. One counter is a NULL column, the other a NOT NULL column.
When I preview the data from the table I see the correct sum of close to 4 million records for both counters. However when I include this in a simple calculation view then I get the below numeric overflow error for the NOT NULL column. The NULL column gives the correct sum without an error.

I understand that the conversion to tinyint causes an error, just don't understand why only in case of a NOT NULL column.

By the way, I do expect a sum to not be limited by the data type of the column.

Error: [314]: numeric overflow: 3746903 at function to_tinyint()