Tag: Timestamp

21 February 2021

TIMESTAMP Function Returns Different Results When Sorted By Different Direction

Recently, I was working on an issue for customer who faced a weird behaviour that TIMESTAMP conversion function returned different results if different sorting direction was used, meaning, results are different if using ASC vs DESC. To illustrate the issue, please see my test case below: Create a table with testing data: 2. Run below query using Ascending order, the timestamp conversion will fail for […]

2 October 2020

Query Failed With Error “Timestamp ‘2020-09-28’ is not recognized”

Most of time when Snowflake query complains about something “is not recognized”, it normally means that Snowflake is not able to CAST a given value to a target type. In my case of “Timestamp ‘2020-09-28’ is not recognized”, it means Snowflake is not able to convert value “2020-09-28” to Timestamp value. This sounds a bit non-sense, as “2020-09-28” is a valid timestamp value, even without […]

2 October 2020

Timestamp Precision Rounding

Currently in Snowflake, it supports using the precision format of FF<N>, where N is a number between 0 to 9, to display precision part of the timestamp value. To demonstrate how it works, please see below examples: By default the output returns only 3 digits, which is up to milliseconds, is because the session level parameter TIMESTAMP_OUTPUT_FORMAT has the default value of “YYYY-MM-DD HH24:MI:SS.FF3 TZHTZM”. […]