INTERVAL YEAR TO MONTH Data Type
Description
INTERVAL YEAR TO MONTH specify an interval data type to store a duration of time in years and months. (RedShift SQL Language Reference Interval data type)
There is no equivalent for this data type in Snowflake, it is currently transformed to VARCHAR.
Grammar Syntax
INTERVAL {YEAR | MONTH | YEAR TO MONTH}The use of the Interval data type is planned for implementation in future updates.
Sample Source Patterns
Interval Year To Month in Create Table
Input:
Output
The Interval value is transformed to a supported Snowflake format and then inserted as text inside the column. Since Snowflake does not support Interval as a data type, it is only supported in arithmetic operations. In order to use the value, it needs to be extracted and used as an Interval constant (if possible).
Original Redshift value: INTERVAL '1-2' YEAR TO MONTH
Value stored in Snowflake column: '1y, 2m'
Value as Snowflake Interval constant: INTERVAL '1y, 2m'
Retrieving data from an Interval Year To Month column
Input
12 years 0 mons
NULL
NULL
NULL
0 years 5 mons
NULL
NULL
NULL
1000 years 11 mons
Output
12 y 0 mm
NULL
NULL
NULL
0 y 5 mm
NULL
NULL
NULL
1000 y 11 mons
Known Issues
1. Only arithmetic operations are supported
Snowflake Intervals have several limitations. Only arithmetic operations between DATE or TIMESTAMP and Interval Constants are supported, every other scenario is not supported.
Related EWIs
SSC-EWI-0036: Data type converted to another data type.
Last updated
