SET CALENDAR Request | Teradata Vantage - Rules and Restrictions for SET SESSION CALENDAR - Advanced SQL Engine - Teradata Database

SQL Data Definition Language Detailed Topics

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Published
July 2021
Language
English (United States)
Last Update
2021-07-27
dita:mapPath
imq1591724555718.ditamap
dita:ditavalPath
imq1591724555718.ditaval
dita:id
B035-1184
lifecycle
previous
Product Category
Teradata Vantage™
The following rules and restrictions apply to SET SESSION CALENDAR requests.
  • You can use SET SESSION CALENDAR to specify one of the following system-defined business calendars:
    • Teradata
    • ISO
    • COMPATIBLE

      You cannot specify a user-defined business calendar.

  • The default calendar for all sessions is Teradata.

    A new logon always sets the session to the system-defined business calendar Teradata by default, but you can change the default using a SET SESSION CALENDAR request.

    You can also include a SET SESSION CALENDAR request in the startup string for a user to set the calendar to something other than the default Teradata calendar. Setting the session calendar in the STARTUP string may result in inconsistent behavior during connection pooling.

    The following CREATE USER statement uses the STARTUP string option to set the default session calendar for user abc to ISO.

    CREATE USER abc AS
    PERM=10E6,
    PASSWORD=abc,
    SPOOL = 1200000,
    FALLBACK PROTECTION,
    STARTUP=’SET SESSION CALENDAR=ISO’;
  • The session-defined business calendar applies to the anchor name and system-defined calendar UDFs specified in the EXPAND ON clause of any DML requests executed in the session.

    For example, if an expansion is by WEEK_BEGIN, the expansion is done by MONDAY for the ISO calendar and by SUNDAY for the Teradata calendar.

  • If you do not specify a business calendar as the second argument for a calendar UDF, Vantage applies the calendar specified for the session.
  • The system-defined business calendar set for the session survives database restarts.

    The calendar name for the session is stored in DBC.SessionTbl, so if a restart occurs, the session can be reestablished with the same business calendar that was set before the restart occurred.

  • You can change the system-defined business calendar at any time in the session.
  • You can change the system-defined business calendar for a session any number of times during that session.
  • The Sys_Calendar.Calendar and Sys_Calendar.BusinessCalendar view columns return values with respect to the calendar that is set for the session.