Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Mon, 29 Mar 2004 @ 20:27:31 GMT


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


Subj:   Re: Float to Timestamp Conversion
 
From:   Anomy Anom

<-- Anonymously Posted: Monday, March 29, 2004 15:19 -->

Please note: TheTime column in the ResUsageSPMA is just 'the time' with no date part. So when you use the below conversion to make it timestamp it appends currentdate to the date part. However if you had a float value with the date part preceding the time part, for example 2004/03/15 6:55:00 as 1040315065500, you will not be able to use the below cast to get it as a timestamp.

>>>> select   cast( cast( cast( cast(thetime as FORMAT '99:99:99') as
>>>> char(8)) as time(6))  as timestamp)
>>>> from DBC.ResUsageSpma

The finger-braking cast to get back the timestamp is right below. If someone can save the fingers I would certainly give him /her an award. Isn't it time that Teradata come forward to get that???? (better have a built-in for this , please )

select CAST(
             (
               CAST( (
                       ((1040315065500/1000000) (date, format 'yyyy-mm-dd')) || ' ' ||
                       ((1040315065500 mod 1000000) (format '99:99:99'))
                     )
                      AS CHAR(19)
                   )
             )
                  AS TimeStamp(0)
           ) ;


     
  <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: 27 Dec 2016