All Forums Database
sukul 3 posts Joined 10/10
30 Oct 2010
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

Jimm 298 posts Joined 09/07
01 Nov 2010

Select Count(*) (Float) From tbl;

It can count as high as the table can grow!

dnoeth 4628 posts Joined 11/04
01 Nov 2010

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

Dieter

robpaller 159 posts Joined 05/09
01 Nov 2010

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.)

dnoeth 4628 posts Joined 11/04
01 Nov 2010

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

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

Dieter

Dieter

You must sign in to leave a comment.