SSC-FDM-TS0024
CURRENT_TIMESTAMP in At Time Zone statement may have a different behavior in certain cases.
Description
This FDM is added when the At Time Zone has the CURRENT_TIMESTAMP. This is because the result might differ in some instances.
The main difference is that in SQL Server, CURRENT_TIMESTAMP returns the current system date and time in the server time zone and in Snowflake CURRENT_TIMESTAMP returns the current date and time in the UTC (Coordinated Universal Time) time zone.
Input Code:
SELECT current_timestamp at time zone 'Hawaiian Standard Time';2024-02-08 16:52:55.317 -10:00
Output Code:
SELECT
CONVERT_TIMEZONE('Pacific/Honolulu', CURRENT_TIMESTAMP() /*** SSC-FDM-TS0024 - CURRENT_TIMESTAMP in At Time Zone statement may have a different behavior in certain cases ***/);2024-02-08 06:53:46.994 -1000
Recommendations
This is an example if you want to keep the same format in Snowflake.
SELECT current_timestamp at time zone 'Hawaiian Standard Time';2024-02-08 16:33:49.143 -10:00
In Snowflake you can use ALTER SESSION to change the default time zone. For example:
ALTER SESSION SET TIMEZONE = 'Pacific/Honolulu';
SELECT
CONVERT_TIMEZONE('Pacific/Honolulu', 'UTC', CURRENT_TIMESTAMP());2024-02-08 16:33:49.143
If you need more support, you can email us at [email protected]
Last updated
