17.10 - Example: Show Week 1 of September 2011 - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Date and Time Functions and Expressions

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B035-1211-171K
Language
English (United States)

This example shows week 1 of September, 2011, for each business calendar setting.

SEL calendar_date, week_of_month FROM Sys_Calendar.BusinessCalendar
WHERE week_of_month = 1
AND month_of_year = 9
AND year_of_calendar = 2011
ORDER BY 1;
SET SESSION calendar = ISO;

Sep-2011 Calendar

S M T W T F S
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30  
calendar_date  week_of_month
-------------  -------------
     11/08/29              1
     11/08/30              1
     11/08/31              1
     11/09/01              1
     11/09/02              1
     11/09/03              1

11/09/04 1

SET SESSION calendar = Teradata;

Sep-2011 Calendar

S M T W T F S
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30  
calendar_date  week_of_month
-------------  -------------
     11/09/04              1
     11/09/05              1
     11/09/06              1
     11/09/07              1
     11/09/08              1
     11/09/09              1
     11/09/10              1
SET SESSION calendar = Compatible;

Sep-2011 Calendar

S M T W T F S
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30  
calendar_date  week_of_month
-------------  -------------
     11/09/01              1
     11/09/02              1
     11/09/03              1
     11/09/04              1
     11/09/05              1
     11/09/06              1
     11/09/07              1