Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Mon, 21 Jan 2013 @ 16:45:09 GMT


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


Subj:   Re: Data format issue
 
From:   Bernard, Vincent L

It seems to be delivering the described intended results on my system:

     CREATE TABLE DATE_TEST
     (
         DATE_COL DATE FORMAT 'YY-MM-DD'
     )
     ;

     INSERT INTO DATE_TEST VALUES ('2012-12-31');
     INSERT INTO DATE_TEST VALUES ('2012-11-30');

     SELECT * FROM DATE_TEST;

        DATE_COL
     1   11/30/2012
     2   12/31/2012


     CREATE  VOLATILE TABLE VTT AS
     (
     SELECT DATE_COL  (format 'YYYY-MM-DD') AS column_1 from DATE_TEST
     ) WITH DATA
     ON COMMIT PRESERVE ROWS
     ;

     SELECT * FROM VTT;

        column_1
     1   11/30/2012
     2   12/31/2012



     SELECT SUBSTRING(CAST((COLUMN_1 (FORMAT 'YYYY-MM-DD')) AS CHAR(10)),1,4)
     FROM VTT
     ;

        Substr(column_1,1,4)
     1   2012
     2   2012

V.Bernard


Vincent Bernard
PS Sr. Consultant



     
  <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