ERROR 2616 Numeric overflow during computation while doing count(*)

Scenario:

While trying to do a select count(*) from a table and I am not able to do it because of this error. I am not aware of the number of rows in the table.

\n\n

Solution:

When your session runs in Teradata mode the result of a COUNT is INTEGER as you already noticed (in ANSI mode it will be a DECIMAL with at least 15 digits).

\n\n

The workaround is simple, cast it to a bigint:

\n\n
SELECT CAST(COUNT(*) AS BIGINT)...\n


dan-irving

posted on

Enjoy great content like this and a lot more !

Signup for a free account to write a post / comment / upvote posts. Its simple and takes less than 5 seconds