Numeric overflow....2616

Database
Fan

Numeric overflow....2616

HI all
I have a question regarding Numeric overflow error. I know that when we are using aggregate functions the datatype of the result is same as that of the Column being aggregated. If the value passes beyond the linit supported by that datatype it gives numeric overflow error.
However is this true in case of COUNT.
What is the datatype of the result when we use count(*).
i want to know what is the maximum count that we can have.?

Thanks in advance
4 REPLIES
Enthusiast

Re: Numeric overflow....2616

Select Count(*) (Float) From tbl;

It can count as high as the table can grow!
Junior Contributor

Re: Numeric overflow....2616

The manuals clearly state the resulting datatype for a COUNT.

ANSI mode: DECIMAL(15,0) or DECIMAL(38,0), depending on the MaxDecimal setting in dbscontrol.
Teradata mode: INTEGER

Dieter
Enthusiast

Re: Numeric overflow....2616

Dieter,

It's surprising with the introduction of BIGINT that the default data type returned in Teradata mode was not changed. (Of course it would wreak havoc with MS Office products that do not support the data type correctly and may have been the deciding factor to leave it at INTEGER. But DECIMAL(38) would cause equal headaches.)
Junior Contributor

Re: Numeric overflow....2616

Hi Rob,
the keyword is probably "backward compatibility".

Most customers don't like it, if any defaults change:-(

Dieter