Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Mon, 27 Dec 2004 @ 09:10:50 GMT


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


Subj:   Re: Selecting days & hours difference
 
From:   Victor Sokovin

  Audit_date datatype is timestamp which holds the value "2004-11-19 10:01:00.000000" and another values is "2004-11-22 15:35:00.000000".  


  we are using the same field for finding the days diff and hours diff and etc.  


  we are getting the days difference by executing the above query but we also need to get the hours diff and etc.  


  What is the procedure to get the days difference and hours difference and etc using the above given query?  



One of the approaches would be to treat date differences as INTERVALs (INTERVAL is a data type in Teradata) and EXTRACT date elements such as days, hours, minutes etc from it (EXTRACT is a function defined in Teradata SQL). There are many examples in the manuals and in this forum's archives. A quick search has yielded this message:

www.teradataforum.com/teradata/20030326_203201.htm .


The whole thread might be worth reading. It covers a lot of popular gotchas associated with ODBC vs Teradata native SQL dealing with timestamps and intervals.

It is worth testing the results as there are still a few bugs in timestamp calculations, at least on V2R5.0 and below. Some of them have been reported on this forum.


Regards,

Victor



     
  <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