I am trying to get the time 'HH:MM:SS' from a timestamp column.
This works but the result is 'HH:MM:SS.ssssss'
SELECT CAST(CURRENT_TIMESTAMP AS TIME);
Tried this and got error 7454 DateTime field overflow
SELECT CAST(CURRENT_TIMESTAMP AS TIME(0));
Is there a way to cast timestamp to time(0) without casting to a char string first?
Database version 14.00.01.10
You can do it in this way
Using an intermediate string:
CAST(SUBSTRING(CAST(x AS CHAR(26)) FROM 1 FOR 19) AS TIMESTAMP(0))