Date and Time Literals | VantageCloud Lake - Date and Time Literals - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
ft:locale
en-US
ft:lastEdition
2024-12-11
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905

Date and time literals declare date, time, or timestamp values in an SQL expression.

ANSI DateTime Literals

ANSI SQL provides DateTime literals to represent date, time, and timestamp values. There are three types of ANSI SQL DateTime literals:
  • DATE
  • TIME
  • TIMESTAMP

Teradata SQL Date and Time Literals

Teradata also provides a non-ANSI extension to DateTime functionality.

Teradata SQL literals used with date or time values are simple string literals and are interpreted as character data. The character data is converted to a date or time value based on the context, typically provided by a FORMAT clause.

The existing Teradata SQL operations on character string literals used to represent date and time values are supported as a non-ANSI extension to DateTime functionality.

While Teradata SQL date and time literals come in a variety of formats for the character representations of date and time values, and so cannot be restricted to a default or standard format, ANSI DateTime literals are restricted to a strict set of formats.

Existing functionality for Teradata SQL date literals is preserved.

For example, suppose a column is defined as DATE with a format of 'YY/MM/DD'. If the value '97/12/31' is encountered as a character literal assigned to a DATE column, the process works as before the introduction of ANSI DateTime formats because the character literal is implicitly cast to the DATE format.

Unless explicitly stated, this section only discusses ANSI DateTime literals.