|
|
Archives of the TeradataForum
Message Posted: Tue, 24 Sep 2002 @ 15:33:47 GMT
Subj: | | Re: Sys_calendar Problem |
|
From: | | Dieter N�th |
Hassinger, Bill wrote:
| I guess I didn't discribe the issue, look closely at the number of months applied to each quarter of the year in the
quarter_of_calendar column. 1st qrt = 3 months, 2nd qtr = 4 months, 3rd qtr = 4 months, 4th qtr = 1 month. | |
This has been fixed since more than three years, you'll probably find the fixed version of calendartmp in dippatch.bteq
Dieter
REPLACE VIEW CALENDARTMP(
calendar_date,
day_of_week,
day_of_month,
day_of_year,
day_of_calendar,
weekday_of_month,
week_of_month,
week_of_year,
week_of_calendar,
month_of_quarter,
month_of_year,
month_of_calendar,
quarter_of_year,
quarter_of_calendar,
year_of_calendar)
AS
SEL
calendar_date,
(day_of_calendar + 0) mod 7 + 1,
day_of_month,
day_of_year,
day_of_calendar,
(day_of_month - 1) / 7 + 1,
(day_of_month - (day_of_calendar + 0) mod 7 + 6) / 7,
(day_of_year - (day_of_calendar + 0) mod 7 + 6) / 7,
(day_of_calendar - (day_of_calendar + 0) mod 7 + 6) / 7,
(month_of_year - 1) mod 3 + 1,
month_of_year,
month_of_year + 12 * year_of_calendar,
(month_of_year + 2) / 3,
(month_of_year + 2) / 3 + 4 * year_of_calendar,
year_of_calendar + 1900
FROM CALBASICS;
| |