td_year_of_calendar
Purpose
Returns the year of the specified date.
Syntax
where:
Syntax element… |
Specifies… |
SYSLIB |
the name of the database where the function is located. |
expression |
an expression that results in a DATE, TIMESTAMP, or TIMESTAMP WITH TIME ZONE value. |
ANSI Compliance
This is a Teradata extension to the ANSI SQL:2011 standard.
Argument Types
td_year_of_calendar is an overloaded scalar function. It is defined with the following parameter data types:
If the argument passed to the function does not match one of these declared data types, an error is returned indicating that the function does not exist.
For more information on overloaded functions, see “Function Name Overloading” in SQL External Routine Programming.
Result
The result is an INTEGER value in 4 digit format representing the year of the specified date.
Usage Notes
The td_year_of_calendar function provides improved performance compared to using the Sys_Calendar.Calendar system view to obtain similar results.
For more information about the CALENDAR system view, see Data Dictionary.
Example
If the current date is November 14, 1977, the following queries return the value 1977 as the result, which is the year of the specified date.
SELECT td_year_of_calendar(CURRENT_DATE);
SELECT td_year_of_calendar(DATE '1977-11-14');