Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Wed, 13 Sep 2006 @ 16:03:49 GMT


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


Subj:   Re: How to FORMAT date
 
From:   Joseph V D silva

The answer to that depends on whether your source column is a character/date column and whether you are querying from Teradata utils or ODBC

This one is sufficient for a Date source column from a teradata utility

     SELECT DT1 (FORMAT 'YYYYMMDD') FROM JOE_001_D01.MY_DT001;

You will have to do this extra trick if you are querying from ODBC

     SELECT CAST ( (DT1 (FORMAT 'YYYYMMDD'))  AS  CHAR(8) ) FROM
     JOE_001_D01.MY_DT001;

Now if your source column was character format, then this is what you should do from a terdata utility

     SELECT    CAST(DT2 AS DATE FORMAT 'YYYY-MM-DD')   (FORMAT 'YYYYMMDD')
     FROM
     JOE_001_D01.MY_DT001;

And this one is for ODBC

     SELECT    CAST( (CAST(DT2 AS DATE FORMAT 'YYYY-MM-DD')   (FORMAT
     'YYYYMMDD'))  AS CHAR(8))  FROM JOE_001_D01.MY_DT001;

Regards

Joseph Vinish D'silva



     
  <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