Snowflake SQL:如何将时间添加到日期以制作日期时间?
Snowflake SQL: How to add a time to a date to make a datetime?
我有一个日期列和一个时间列,我想制作一个 datetime/timestamp。
我试过了
Date+Time
但我得到:
SQL compilation error: error line 4 at position 14 Invalid argument types for function '+': (DATE, TIME(9))
您可以使用TIMESTAMP_NTZ_FROM_PARTS(date, time),例如
select timestamp_ntz_from_parts('2013-04-05'::date, '01:02:03.12345'::time);
----------------------------------------------------------------------+
TIMESTAMP_NTZ_FROM_PARTS('2013-04-05'::DATE, '01:02:03.12345'::TIME) |
----------------------------------------------------------------------+
2013-04-05 01:02:03.123450000 |
----------------------------------------------------------------------+
我有一个日期列和一个时间列,我想制作一个 datetime/timestamp。
我试过了
Date+Time
但我得到:
SQL compilation error: error line 4 at position 14 Invalid argument types for function '+': (DATE, TIME(9))
您可以使用TIMESTAMP_NTZ_FROM_PARTS(date, time),例如
select timestamp_ntz_from_parts('2013-04-05'::date, '01:02:03.12345'::time);
----------------------------------------------------------------------+
TIMESTAMP_NTZ_FROM_PARTS('2013-04-05'::DATE, '01:02:03.12345'::TIME) |
----------------------------------------------------------------------+
2013-04-05 01:02:03.123450000 |
----------------------------------------------------------------------+