Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Fri, 26 Oct 2012 @ 15:54:30 GMT


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


Subj:   Re: How to Convert a VARCHAR date into TIMESTAMP(0) format
 
From:   Dave Wellman

Hi,

You need to convert the data value into the standard timestamp display format (yyyy-mm-dd hh:mm:ss) and then CAST that as TIMESTAMP(0).

The following should work (assume column name is c1):

     CAST( (SUBSTRING(c1 FROM 1 FOR 4)||'-'|| SUBSTRING(c1 FROM 5 FOR 2)||'-'||
     SUBSTRING(c1 FROM 7 FOR 2)||' '|| SUBSTRING(c1 FROM 10 FOR 8)) AS TIMESTAMP(0))

Cheers,

Dave

Ward Analytics Ltd - Information in motion (www.ward-analytics.com)



     
  <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