Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Thu, 10 Feb 2005 @ 10:44:37 GMT


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


Subj:   Re: Epoch function
 
From:   Dennis Calkins

Just out of curiosity is there a way short of making some sort of derived table to assign

     (cast ((millisecs / 1000 )  as integer))

a name like

     (cast ((millisecs / 1000 )  as integer))  secs

so that you can use that throughout your query, without the column SECS appearing in the final output?

     sel  1107982900000 millisecs,
        (cast ((millisecs / 1000 )  as integer))  secs,
        cast (
          (( date '1970-01-01' + (secs /  86400 ) ) ( format 'yyyy-mm-dd'))
             || ' ' ||
           ((( secs mod 86400) / 3600 ) (format '99' ))
                   || ':' ||
           ((( secs mod 3600 )  / 60) (format '99' ))
                   || ':' ||
           ((( secs mod (60))) (format '99' ))
                   || '.' ||
           ((millisecs mod 1000) (format '999' ))
                   || '000'
                as timestamp(6) )  mytimestamp;

I guess if you were making this a View on top of the base table to do the translation it wouldn't matter if you had a couple extraneous columns to make the DDL look a little cleaner.



     
  <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