SSC-EWI-TS0060

Datetime interval not supported by Snowflake.

Severity

Medium

Description

This EWI is added when one of the following time parts is used as a parameter for a date-related function because they are not supported in Snowflake. For more information go to 'supported date time parts (Date & Time Functions | Snowflake Documentation).

Code Example

Input code

IN -> SqlServer_01.sql
SELECT
    -- Supported
    DATEPART(second, getdate()),
    -- Not supported
    DATEPART(millisecond, getdate()),
    DATEPART(microsecond, getdate());

Output code:

OUT -> SqlServer_01.sql
SELECT
    -- Supported
    DATE_PART(second, CURRENT_TIMESTAMP() :: TIMESTAMP),
    -- Not supported
    !!!RESOLVE EWI!!! /*** SSC-EWI-TS0060 - TIME PART 'millisecond' NOT SUPPORTED AS A FUNCTION PARAMETER ***/!!!
    DATEPART(millisecond, CURRENT_TIMESTAMP() :: TIMESTAMP),
    !!!RESOLVE EWI!!! /*** SSC-EWI-TS0060 - TIME PART 'microsecond' NOT SUPPORTED AS A FUNCTION PARAMETER ***/!!!
    DATEPART(microsecond, CURRENT_TIMESTAMP() :: TIMESTAMP);

Recommendations

Last updated