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. |
Exact Numeric | Interval | The INTERVAL type must have only one field, for example, INTERVAL YEAR. |
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. |
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.