Sys_Calendar.BusinessCalendar - Analytics Database - Teradata Vantage

SQL Date and Time Functions and Expressions

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
ft:locale
en-US
ft:lastEdition
2023-10-30
dita:mapPath
cpk1628111786971.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
pxz1544241488545
lifecycle
latest
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 YYYY/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 YYYY/MM/DD
WeekBegin The beginning of the week for the given date. DATE YYYY/MM/DD
MonthBegin The beginning of the month for the given date. DATE YYYY/MM/DD
MonthEnd The end of the month for the given date. DATE YYYY/MM/DD
QuarterBegin The beginning of the quarter for the given date. DATE YYYY/MM/DD
QuarterEnd The end of the quarter for the given date. DATE YYYY/MM/DD
YearBegin The beginning of the year for the given date. DATE YYYY/MM/DD
YearEnd The end of the year for the given date. DATE YYYY/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 YYYY/MM/DD
BusinessWeekEnd The last working day of the week in which the given date occurs. DATE YYYY/MM/DD
BusinessMonthBegin The first working day of the month in which the given date occurs. DATE YYYY/MM/DD
BusinessMonthEnd The last working day of the month in which the given date occurs. DATE YYYY/MM/DD
BusinessQuarterBegin The first working day of the quarter in which the given date occurs. DATE YYYY/MM/DD
BusinessQuarterEnd The last working day of the quarter in which the given date occurs. DATE YYYY/MM/DD
BusinessYearBegin The first working day of the year in which the given date occurs. DATE YYYY/MM/DD
BusinessYearEnd The last working day of the year in which the given date occurs. DATE YYYY/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';

Result:

day_of_week
-----------
6