17.00 - Example: Partitioning Expression With TIMESTAMP Data Type - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Data Definition Language Syntax and Examples

Product
Advanced SQL Engine
Teradata Database
Release Number
17.00
Release Date
September 2020
Content Type
Programming Reference
Publication ID
B035-1144-170K
Language
English (United States)

Assume that column tsz has a TIMESTAMP(0) WITH TIME ZONE data type and the current session time zone is INTERVAL -'07:00' HOUR TO MINUTE when the table that contains column tsz is created with the following PARTITION BY clause. The RANGE_N function has a BIGINT data type.

 PARTITION BY RANGE_N(tsz BETWEEN TIMESTAMP '2003-01-01 00:00:00.000000'
                          AND     TIMESTAMP '2009-12-31 23:59:59.999999' 
                          EACH INTERVAL '1' DAY)

Vantage implicitly rewrites this partitioning expression to include the time zone in the timestamp literals as follows.

     RANGE_N(tsz BETWEEN TIMESTAMP '2003-01-01 00:00:00.000000-07:00'
                 AND     TIMESTAMP '2009-12-31 23:59:59.999999-07:00' 
                 EACH INTERVAL '1' DAY)