Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Fri, 29 Feb 2008 @ 20:47:20 GMT


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


Subj:   Re: Char to date in teradata
 
From:   Michael Larkins

Oh David, you were so close with the date math, however the year is stored as an offset from the year 1900. This year is 108 + 1900 = 2008.

So you would need to do this for current year:

     (current_date/10000+1900) * 10000 + 1231 (date)

or for prior year:

     (current_date/10000+1899) * 10000 + 1231 (date)

Now, with all this said, if he really is trying to back up one year, why not do this:

     add_months(store_year,-12)

It just depends if he is backing up one year or one day in that goofy looking Oracle code using all those functions (my opinion of course...lol)


Regards,

Michael Larkins
Certified Teradata Master
Certified Teradata SQL Instructor



     
  <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