Home Page for the TeradataForum

Archives of the TeradataForum

Message Posted: Thu, 03 Jul 2008 @ 13:11:47 GMT

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

Subj:   Re: Subtracting timestamps
From:   Alves, Patrick

Hi Venkat,

a substraction of 2 dates (or timestamps) do not give a timestamp value but an interval value :

     select cast('2030-12-31 00:00:00' as timestamp(0))

     - cast('2008-06-25 16:23:15' as timestamp(0)) day(4) to second(0) ;

the result is : 8223 07:36:45

the problem is that the difference of your 2 dates is too big to be keep in an interval values.

You could read teradata documantion ( sql reference, chapter datatype and litteral).

maybe you can split your calcultation getting first the interval year, then the interval month and then day to second but i m not sure that you gat the exact calculation

Could you explain why you want to do that kind of calculation, maybe we can do the expected result by another way?


Patrick Alves
PS Teradata Consultant.

  <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: 28 Jun 2020