Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Fri, 21 Mar 2003 @ 17:21:50 GMT


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


Subj:   Re: Error Trapping with Timestamp
 
From:   Maxwell, Donald

Try:

SELECT  '2003-03-31 24:00:00' MyCol
     ,CAST(substring(MyCol, 1, 10) || ' 00:00:00' AS TIMESTAMP(0)) A
     ,CAST(substring(MyCol, 12, 8) AS INTERVAL HOUR TO SECOND) B
     ,A + B CorrectTimestamp

This will yield a CorrectTimestamp of '2003-04-01 00:00:00'

The key is to treat the date and time portions of your string as seperate datatypes, timestamp and interval respectively. Then you can just add the interval to the timestamp to get the correct timestamp.

Donald Maxwell



     
  <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