Interval Literals

Important Notice: Migration of Documentation Website

Please be advised that our documentation website is currently undergoing a migration to a new platform. To ensure you have access to the most up-to-date information, we kindly request that you visit our new documentation website located at:

Official Snowflake Snowconvert Documentation

For any immediate assistance or if you encounter any issues, please contact our support team at [email protected].

Thank you for your understanding.

Description

Interval literals can be used in datetime calculations, such as, adding intervals to dates and timestamps, summing intervals, and subtracting an interval from a date or timestamp. Interval literals can be used as input values to interval data type columns in a table.. (Redshift SQL Language reference Interval Literals).

Grammar Syntax

INTERVAL quoted-string [ year_to_month_qualifier ]
INTERVAL quoted-string [ day_to_second_qualifier ] [ (fractional_precision) ]

Snowflake Intervals can only be used in arithmetic operations. Intervals used in any other scenario are not supported.

The following formats are the only ones recognized and fully transformed by SnowConvert, allowing optional fields and most of the abbreviations without interval styles:

1. 1 year 1 month 1 day 2 hour 3 minutes 4 seconds 123 ms
2. hh:mm:ss.ms
3. 1 year 1 month 1 day hh:mm:ss.ms

Snowflake does not support literals with arithmetic signs. If the Literal contains an hour expression the expression can be partially transformed.

Sample Source Patterns

Supported scenarios

Input Code:

Output Code:

Pending translation scenarios

Input Code:

Output Code:

Know Issues

No issues were found.

  1. SSC-EWI-0107: Interval Literal Not Supported In Current Scenario.

  2. SSC-EWI-0073: Pending Functional Equivalence Review.

Last updated