Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Fri, 09 Jan 2009 @ 18:41:04 GMT


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


Subj:   Re: Extracting Week from date
 
From:   Anderson, Dirk

Look at the calculation below for "week_number" and see if it will work for you....

     SEL calendar_date
         ,(((calendar_date - CAST(((EXTRACT(YEAR FROM
     calendar_date)-1900)*10000) + 101 AS DATE))) / 7)+1 AS week_number
     FROM sys_calendar.calendar
     WHERE calendar_date BETWEEN '2008-01-01' AND '2009-12-31'
     ORDER BY 1

Dirk Anderson



     
  <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: 27 Dec 2016