Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Sat, 22 Sep 2012 @ 08:49:29 GMT


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


Subj:   Re: add_months for integer-type dates
 
From:   Geoffrey Rommel

  We're often dealing with monthly data. That's why our DWH architect decided to define dates as integer of the format YYYYMM.  


If you're planning to write a UDF, you can easily split the integer into year (date_code / 100) and month (date_code % 100) portions. Then you can compute a sequential month number (e.g. Jan of year 0 = 1, Jan. 2000 = 24001, etc.), add or subtract as needed, and convert it back to the coded form.

Come to think of it, using a sequential month number would probably have been a better choice to begin with, but it's probably too late to change that now.



     
  <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