Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Thu, 01 Jul 2004 @ 16:45:52 GMT


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


Subj:   Re: Aiii, INTERVALs!
 
From:   Maxwell, Donald

I suggest you treat the HOUR TO MINUTE and SECONDS components seperately, eg.

     SELECT  (T2 - T1 HOUR TO MINUTE)
             + CAST ( (EXTRACT ( SECOND FROM (T2 - T1 HOUR TO SECOND) )
                  (DECIMAL(5,1))) AS INTERVAL SECOND )

Alternatively, you could compute the decimal number of seconds between your timestamps, round to 1 significant digit, then CAST back to the HOUR TO SECOND interval datatype, eg.

     SELECT  ( EXTRACT ( SECOND FROM (T2 - T1 HOUR TO SECOND) / 3600 )
              * 3600 (DECIMAL(9,1)) )
              * CAST ( '00:00:01.0' AS INTERVAL HOUR(2) TO SECOND(1) )

Donald Maxwell



     
  <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