Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Wed, 02 Apr 2003 @ 17:49:56 GMT


     
  <Prev Next>   <<First <Prev Next> Last>>  


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



     
  <Prev Next>   <<First <Prev Next> Last>>  
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023