我正在尝试将varchar(19)时间戳字段从平面文件转换为Teradata时间戳,但是我收到以下错误。
select TOP 100
TO_TIMESTAMP (SOURCE_DTTM , 'YYYY-MM-DD HH:MI:SS') AS TS1
FROM "TEST"."CUSTOMER"
WHERE SOURCE_DTTM NOT LIKE '%0000-00-00%';
Executed as Single statement. Failed [9134 : HY000] Teradata hour of day must be in range 1-12
Elapsed time = 00:00:00.078
STATEMENT 1: Select Statement failed.
我想知道是否有办法将时间戳指定为24小时格式。
真的很感激。
答案 0 :(得分:2)
我去了info.teradata.com并找到了正确的语法:
select TOP 100
TO_TIMESTAMP (SOURCE_DTTM , 'YYYY-MM-DD HH24:MI:SS') AS TS1
FROM "TEST"."CUSTOMER"
WHERE SOURCE_DTTM NOT LIKE '%0000-00-00%';