Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Tue, 13 May 2008 @ 11:00:32 GMT


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


Subj:   Re: Need help to convert Oracle code to Teradata
 
From:   jonas.blomqvist

Gagan,

Asuming that the expected functionallity is to get the year and month for a day-in-year sequential stored as an integer (with 0 corresponding to the date 1900-01-01), the following Teradata expression should do the trick.

     CAST(CAST(CAST(
     CAST(CAST(
     (CASE WHEN column_name = 0 THEN 1900001 ELSE column_name END)
     AS FORMAT '9(7)') AS CHAR(7))
     AS DATE FORMAT 'YYYYDDD') AS FORMAT 'YYYYMM') AS CHAR(6))

Jonas Blomqvist



     
  <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