Implicit Conversion of DateTime Types | VantageCloud Lake - Implicit Conversion of DateTime Types - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
Language
English (United States)
Last Update
2024-04-03
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905
Analytics Database performs implicit conversion on DateTime data types in the following cases:
  • When passing data using dynamic parameter markers, or the question mark (?) placeholder.
  • With INSERT, INSERT ... SELECT, and UPDATE statements.
  • With MERGE INTO statements.
  • When handling default values for the CREATE TABLE and ALTER TABLE statements. For more information, see DEFAULT Phrase.
  • During stored procedure execution, including the execution of the following statements: DECLARE, SELECT ... INTO, and SET.

Implicit conversion is dependent on client-side support. For information about the client products which support implicit conversion of DateTime types, see the Teradata Tools and Utilities user documentation.

The following conversions are supported.

Original Data Type New Data Type Reference
DATE TIMESTAMP Implicit DATE-to-TIMESTAMP Conversion.
TIME TIMESTAMP Implicit TIME-to-TIMESTAMP Conversion.
TIMESTAMP DATE Implicit TIMESTAMP-to-DATE Conversion.
TIMESTAMP TIME Implicit TIMESTAMP-to-TIME Conversion.
INTERVAL INTERVAL Numeric-to-INTERVAL Conversion Usage Notes.

Analytics Database performs implicit conversion on DateTime data types during assignment in the following cases:

Original Data Type New Data Type Reference
DATE TIMESTAMP Implicit DATE-to-TIMESTAMP Conversion.
TIME TIMESTAMP Implicit TIME-to-TIMESTAMP Conversion.
TIMESTAMP DATE Implicit TIMESTAMP-to-DATE Conversion.
TIMESTAMP TIME Implicit TIMESTAMP-to-TIME Conversion.
Interval Exact Numeric The INTERVAL type must have only one field, for example, INTERVAL YEAR.

Implicit INTERVAL-to-Numeric Conversion.

Exact Numeric Interval The INTERVAL type must have only one field, for example, INTERVAL YEAR.

Implicit Numeric-to-INTERVAL Conversion.

There is a general restriction that in Numeric-to-Interval conversions, the INTERVAL type must have only one DateTime field. However, this restriction is not an issue when implicitly converting the expression of an AT clause because the conversion is done with two CAST statements. See AT LOCAL and AT TIME ZONE Time Zone Specifiers.

Analytics Database performs implicit conversion on DateTime data types in single table predicates and join predicates in the following cases:

Original Data Type New Data Type Reference
TIMESTAMP DATE Implicit TIMESTAMP-to-DATE Conversion.
Interval Exact Numeric The INTERVAL type must have only one field, for example, INTERVAL YEAR.

Implicit INTERVAL-to-Numeric Conversion.

Exact Numeric Interval Implicit Numeric-to-INTERVAL Conversion.
The following are not supported:
  • Implicit conversion from TIME to TIMESTAMP and from TIMESTAMP to TIME are not supported in comparisons.
  • Implicit conversion of DateTime types in set operations.