Example - Advanced SQL Engine - Teradata Database

SQL Data Types and Literals

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Published
July 2021
Language
English (United States)
Last Update
2021-07-27
dita:mapPath
tpf1598412463935.ditamap
dita:ditavalPath
tpf1598412463935.ditaval
dita:id
B035-1143
lifecycle
previous
Product Category
Teradata Vantageā„¢

In this example, the tswz column in table1 contains the following timestamp data:

SELECT * FROM table1;

The result of the query is:

                               tswz
-----------------------------------
   2011-11-04 13:14:00.860000-07:00

You can use an AT clause with a time zone string in a SELECT query to get the same time in a different time zone. For example:

SELECT CAST(tswz AS TIMESTAMP WITH TIME ZONE AT 'gmt') 
FROM table1; 

The result of the query is:

                               tswz
-----------------------------------
   2011-11-04 20:14:00.860000+00:00

Similarly, you can use an AT clause with a time zone displacement to get the same result.

SELECT CAST(tswz AS TIMESTAMP WITH TIME ZONE AT TIME ZONE '00:00')
FROM table1; 

The result of the query is:

                               tswz
-----------------------------------
   2011-11-04 20:14:00.860000+00:00

The following query produces the same result without an explicit CAST:

SELECT tswz AT 'gmt' FROM table1;

The result of the query is:

            tswz AT TIME ZONE 'gmt'
-----------------------------------
   2011-11-04 20:14:00.860000+00:00