Sys_Calendar.BusinessCalendar - Advanced SQL Engine - Teradata Database

SQL Date and Time Functions and Expressions

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
June 2020
Language
English (United States)
Last Update
2021-01-24
dita:mapPath
xmd1556127764262.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1211
lifecycle
previous
Product Category
Teradata Vantageā„¢

This Sys_Calendar view provides business functionality for the three system-defined business calendars.

View Column Name Description Data Type Format
Calendar_Date The date. DATE YY/MM/DD
Day_of_Week An integer value that ranges from 1 to 7. INTEGER -(10)9
Day_of_Month A integer value that ranges from 1 to 31. INTEGER -(10)9
Day_of_Year An integer value that ranges from 1 to 366. INTEGER -(10)9
Day_of_Calendar The number of days since the beginning of the calendar. INTEGER -(10)9
Weekday_of_Month The nth occurrence of the weekday in the month (1-5). INTEGER -(10)9
Week_of_Month The week number of the month, ranging from 0 to 5. INTEGER -(10)9
Week_of_Quarter The week number of the quarter, ranging from 0 to 14. INTEGER -(10)9
Week_of_Year The week number of the year, ranging from 0 to 53. INTEGER -(10)9
Week_of_Calendar For a given date, the number of the week in the calendar in which it occurs. INTEGER -(10)9
Month_of_Quarter For a given date, the number of the month in the quarter in which it occurs. INTEGER -(10)9
Month_of_Year For a given date, the number of the month in the year in which it occurs. INTEGER -(10)9
Month_of_Calendar For a given date, the number of the month in the calendar in which it occurs. INTEGER -(10)9
Quarter_of_Year For a given date, the quarter of the year in which it occurs. INTEGER -(10)9
Quarter_of_Calendar For a given date, the quarter number of the calendar in which it occurs. INTEGER -(10)9
Year_of_Calendar For a given date, the year number of the calendar in which it occurs. INTEGER -(10)9
WeekEnd The end of the week for the given date. DATE YY/MM/DD
WeekBegin The beginning of the week for the given date. DATE YY/MM/DD
MonthBegin The beginning of the month for the given date. DATE YY/MM/DD
MonthEnd The end of the month for the given date. DATE YY/MM/DD
QuarterBegin The beginning of the quarter for the given date. DATE YY/MM/DD
QuarterEnd The end of the quarter for the given date. DATE YY/MM/DD
YearBegin The beginning of the year for the given date. DATE YY/MM/DD
YearEnd The end of the year for the given date. DATE YY/MM/DD
IsBusinessDay Whether or not the given day is a business day. BYNET -(3)9
BusinessWeekBegin The first working day of the week in which the given date occurs. DATE YY/MM/DD
BusinessWeekEnd The last working day of the week in which the given date occurs. DATE YY/MM/DD
BusinessMonthBegin The first working day of the month in which the given date occurs. DATE YY/MM/DD
BusinessMonthEnd The last working day of the month in which the given date occurs. DATE YY/MM/DD
BusinessQuarterBegin The first working day of the quarter in which the given date occurs. DATE YY/MM/DD
BusinessQuarterEnd The last working day of the quarter in which the given date occurs. DATE YY/MM/DD
BusinessYearBegin The first working day of the year in which the given date occurs. DATE YY/MM/DD
BusinessYearEnd The last working day of the year in which the given date occurs. DATE YY/MM/DD

Example: Querying for Day of the Week Using the ISO Calendar

This query returns the day of the week using the ISO calendar.

Set session calendar = iso;
Sel day_of_week from Sys_Calendar.Calendar where calendar_date = date '2011-01-01';
day_of_week
-----------
6