How to select current timestamp in Teradata SQL just like we use "select date" or "select current_date" to get the current date
There are two possible ways to get the desired results:
SELECT CAST(CAST(CURRENT_DATE AS FORMAT 'YYYY-MM-DD') || ' ' || CAST(CAST(CURRENT_TIME AS FORMAT 'HH:MI:SS') AS CHAR(8)) AS TIMESTAMP(0));
AND
SELECT CAST(CURRENT_DATE AS TIMESTAMP(0)) + ((CURRENT_TIME - TIME '00:00:00') HOUR TO SECOND(0));
Both the above queries will display the same results in Teradata sql.
0 comments:
Post a Comment