Data Type Compatibility and Conversion | Teradata Vantage - Data Type Compatibility and Conversion - Advanced SQL Engine - Teradata Database

SQL Date and Time Functions and Expressions

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
June 2020
Language
English (United States)
Last Update
2021-01-24
dita:mapPath
xmd1556127764262.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1211
lifecycle
previous
Product Category
Teradata Vantageā„¢

The following rules apply to assignments involving ANSI DateTime or Interval data types:

Source Type Target Type Description
DATE DATE The types are compatible and assignments do not require conversion.

For compatibility with existing Teradata assignments, non-ANSI operations such as assigning a DATE to an INTEGER or an INTEGER to a DATE (with validity checking) follow existing Teradata assignment rules.

TIME TIME The types are compatible and assignments do not require conversion.

The Teradata system value TIME is encoded as a REAL and is not compatible with ANSI TIME or TIME WITH TIME ZONE.

TIMESTAMP TIMESTAMP The types are compatible and assignments do not require conversion.
Year-Month INTERVAL Year-Month INTERVAL
Day-Time INTERVAL Day-Time INTERVAL
Numeric DATE Teradata Database performs implicit type conversion before the assignment.

For more information, see "Implicit Type Conversions" in Teradata Vantageā„¢ - Data Types and Literals, B035-1143.

DATE
  • Character
  • Numeric
  • TIMESTAMP
Character
  • DATE
  • TIME
  • TIMESTAMP
TIME TIMESTAMP
TIMESTAMP
  • DATE
  • TIME
Interval
The INTERVAL type must have only one field. For example, INTERVAL YEAR.
Exact Numeric
Exact Numeric Interval

For all other source/target data type combinations in assignments involving ANSI DateTime or Interval data types, the types must be explicitly converted.

To perform explicit conversions on ANSI DateTime or Interval data types, use the CAST function.