- 16.20 - Overview of Date and Time Literals - Teradata Vantage NewSQL Engine

Teradata Vantage™ Data Types and Literals

Teradata Database
Teradata Vantage NewSQL Engine
Programming Reference

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

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. These are converted to a date or time value based on the context, which is usually 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 just as it did prior to 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.