Usage Notes - Advanced SQL Engine - Teradata Database

SQL Data Types and Literals

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
June 2020
Language
English (United States)
Last Update
2021-01-22
dita:mapPath
zsn1556242031050.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1143
lifecycle
previous
Product Category
Teradata Vantage™

If you specify an AT clause for a TIME[(n)] without time zone target data type, an error is returned.

If you specify an AT clause for a TIME[(n)] WITH TIME ZONE target data type, the following table shows the result of the CAST function or Teradata conversion based on the various options specified. If the target precision is higher than the source precision, trailing zeros are added in the result to adjust the precision. If the target precision is lower than the source precision, an error is returned.

IF you specify... AND the data type of time_expression is... THEN...
AT LOCAL with or without TIME ZONE THEN...
AT SOURCE

(where SOURCE is a keyword and not a column reference)

WITH TIME ZONE the result is formed from the source time_expression (in UTC) and the time zone displacement based on the current session time zone.

If the data type of time_expression is without time zone, this is the same as not specifying the AT clause.

AT SOURCE

(where SOURCE is a keyword and not a column reference)

without TIME ZONE the result is formed from the time portion of the source time_expression (in UTC) and the time zone displacement associated with time_expression.

Note that this is the same as not specifying the AT clause.

AT SOURCE TIME ZONE WITH TIME ZONE the result is formed from the time portion of the source time_expression (in UTC) and the time zone displacement associated with time_expression.

Note that this is the same as not specifying the AT clause.

AT SOURCE TIME ZONE without TIME ZONE an error is returned.
AT expression 
or
AT TIME ZONE expression with or without TIME ZONE the result is formed from the time portion of the source time_expression (in UTC) and the time zone displacement defined by expression.
AT time_zone_string
or
AT TIME ZONE time_zone_string with or without TIME ZONE the result is formed from the time portion of the source time_expression (in UTC) and the time zone displacement based on time_zone_string. The time zone displacement is determined based on time_zone_string, CURRENT_TIMESTAMP AT '00:00', and the TIME value of time_expression at UTC.