Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Thu, 07 Mar 2002 @ 08:02:16 GMT


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


Subj:   Re: Days between
 
From:   Dennis Calkins

Sam Mosley wrote:

  sel current_date - ('2002/02/01' (date)) (interval day(3));  


  You can specify your interval in days, months to days, etc. The number in the parenthesis (3) is the number of digits to hold the answer. If you don't provide sufficient digits it will error with an overflow.  



If you specify interval day it limits the result to that many digits

interval day(1)  returns a value < 10    and OVERFLOW if >= 10
interval day(2)  returns a value < 100   and OVERFLOW if >= 100
interval day(3)  returns a value < 1000  and OVERFLOW if >= 1000
interval day(4)  returns a value < 10000 and OVERFLOW if >= 10000

The last one amounts to about 27 years. however you don't need to specify interval day(x)

sel current_date - ('1966/01/23' (date)) ;

 *** Query completed. One row found. One column returned.
 *** Total elapsed time was 1 second.

(Date-'1966/01/23')
-------------------
              13191

works just fine and allows for values beyond 27 years.



     
  <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