Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Wed, 08 Jun 2005 @ 11:48:04 GMT


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


Subj:   Re: Using Add_Months with column defined as 'YYYYMM' (Char(6))
 
From:   Herd, Stuart

I've used logic like;

     select cast( cast(ADD_MONTHS(CAST( SUBSTRING(TRIM(DATE_FIELD) FROM 1 FOR 4)
     ||'-'||SUBSTRING(TRIM(DATE_FIELD) FROM 5)||'-01' AS DATE),-36) as date
     FORMAT 'YYYYMM') as char(6))

In code in the past. Not pretty, but gets the job done.

Stuart



     
  <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