Usage Notes - Teradata Vantage - Analytics Database

SQL Data Types and Literals

Deployment
VantageCloud
VantageCore
Edition
VMware
Enterprise
IntelliFlex
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
ft:locale
en-US
ft:lastEdition
2025-11-06
dita:mapPath
uds1628112204571.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
exs1472253032394
lifecycle
latest
Product Category
Teradata Vantageā„¢

If you specify the AT clause for a TIMESTAMP[(n)] without 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 the source time_expression (in UTC) is adjusted by adding the time zone displacement based on the current session time zone. A local timestamp value is formed from CURRENT_DATE (at the same time zone displacement) and the time portion of time_expression obtained after the previous adjustment. The result is this local timestamp value adjusted to UTC by subtracting the time zone displacement.

This is the same as not specifying the AT clause.

AT SOURCE

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

WITH TIME ZONE the source time_expression (in UTC) is adjusted by adding the time zone displacement of time_expression. A local timestamp value is formed from CURRENT_DATE (based on the time zone displacement of time_expression) and the time portion of time_expression obtained after the previous adjustment. The result is this local timestamp value adjusted to UTC by subtracting the time zone displacement of time_expression.
AT SOURCE

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

without TIME ZONE an error is returned.
AT SOURCE TIME ZONE WITH TIME ZONE the source time_expression (in UTC) is adjusted by adding the time zone displacement of time_expression. A local timestamp value is formed from CURRENT_DATE (based on the time zone displacement of time_expression) and the time portion of time_expression obtained after the previous adjustment. The result is this local timestamp value adjusted to UTC by subtracting the time zone displacement of time_expression.
AT SOURCE TIME ZONE without TIME ZONE an error is returned.
AT expression

or

AT TIME ZONE expression

with or without TIME ZONE the source time_expression (in UTC) is adjusted by adding the time zone displacement defined by expression.

A local timestamp value is formed from CURRENT_DATE at the same time zone displacement and the time portion of time_expression obtained after the adjustment. The result is this local timestamp value adjusted to UTC by subtracting the time zone displacement.

AT time_zone_string

or

AT TIME ZONE time_zone_string

with or without TIME ZONE the source time_expression (in UTC) is adjusted by adding 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.

A local timestamp value is formed from CURRENT_DATE at the same time zone displacement and the time portion of time_expression obtained after the adjustment. The result is this local timestamp value adjusted to UTC by subtracting the time zone displacement.

If you specify the AT clause for a TIMESTAMP[(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 the source time_expression (in UTC) is adjusted by adding the time zone displacement based on the current session time zone. A local timestamp value is formed from CURRENT_DATE (at the same time zone displacement) and the time portion of time_expression obtained after the adjustment. This resulting timestamp is adjusted to UTC, and the result value of the CAST at UTC is adjusted to the time zone displacement.

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)

WITH TIME ZONE the source time_expression (in UTC) is adjusted by adding the time zone displacement of time_expression. A local timestamp value is formed from CURRENT_DATE (based on the time zone displacement of time_expression) and the time portion of time_expression obtained after the previous adjustment. This resulting timestamp is adjusted to UTC, and the result value of the CAST at UTC is adjusted to the time zone displacement of time_expression.
AT SOURCE

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

without TIME ZONE an error is returned.
AT SOURCE TIME ZONE WITH TIME ZONE the source time_expression (in UTC) is adjusted by adding the time zone displacement of time_expression. A local timestamp value is formed from CURRENT_DATE (based on the time zone displacement of time_expression) and the time portion of time_expression obtained after the previous adjustment. This resulting timestamp is adjusted to UTC, and the result value of the CAST at UTC is adjusted to the time zone displacement of time_expression.
AT SOURCE TIME ZONE without TIME ZONE an error is returned.
AT expression

or

AT TIME ZONE expression

with or without TIME ZONE the source time_expression (in UTC) is adjusted by adding the time zone displacement defined by expression.

A local timestamp value is formed from CURRENT_DATE (at the same time zone displacement) and the time portion of time_expression obtained after the adjustment. This resulting timestamp is adjusted to UTC, and the result value of the CAST at UTC is adjusted to the time zone displacement.

AT time_zone_string

or

AT TIME ZONE time_zone_string

with or without TIME ZONE the source time_expression (in UTC) is adjusted by adding 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.

A local timestamp value is formed from CURRENT_DATE (at the same time zone displacement) and the time portion of time_expression obtained after the adjustment. This resulting timestamp is adjusted to UTC, and the result value of the CAST at UTC is adjusted to the time zone displacement.