Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Wed, 01 Sep 2004 @ 14:10:46 GMT


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


Subj:   Re: Generating week dates without sys_calendar
 
From:   teradatanewsgroup

Hi,

the following will fix the Sunday / Monday problem but it still not show the correct calendar_week which can be sometimes 53 and never be 0...

Do you have the calendar week and a start date or "only" a calendar week like 2004/15? And can it be a 53?


Ulrich


SQL

     select calendar_date,

     day_of_week,

     case when day_of_week = 1 then 7 else day_of_week - 1 end as
     new_day_of_week,

     week_of_year,

     case when day_of_week = 1 then week_of_year - 1 else week_of_year end as
     new_week_of_year

     from sys_calendar.calendar

     where calendar_date between '2004-12-10' and '2005-01-10'

     order by 1 desc;


     
  <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