Archives of the TeradataForum
Message Posted: Wed, 02 Apr 2003 @ 17:49:56 GMT
Subj: | | Re: Numeric overflow when inserting |
|
From: | | Michael McIntire |
When I run into these overflows, I write a query that casts to float and then tests for a value greater than the width of the native type
or some threshold value:
Select sum( cast(smallint_col as float) ) as sint_sum
,sum( cast(dec_col as float) ) as dec_sum
,sum( cast(int_col as float) ) as int_sum
,case when sum( cast(smallint_col as float) ) GT 32000 then
'true' else ' ';
,case when sum( cast(dec_col as float) ) GT 9999999999999999
then 'true' else ' '
,case when sum( cast(int_col as float) ) GT 23000000 then 'true'
else ' ' From problem_table;
And unfortunately, you cannot tell from the ODBC error which column is the issue.
Michael McIntire
Baseline Consulting Group
|