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

SQL Data Definition Language Syntax and Examples

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
Published
January 2021
Language
English (United States)
Last Update
2021-01-22
dita:mapPath
ncd1596241368722.ditamap
dita:ditavalPath
hoy1596145193032.ditaval
dita:id
B035-1144
lifecycle
previous
Product Category
Teradata Vantage™

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)