从分段中插入我的ODS,在我的日期列时会出现错误,我该更改代码?
我已经将数据加载到了舞台上,该分段整体上都顺利进行,但是现在,当试图将数据插入到ODS中时,我的SQL错误。除温度_tmp
和stecitation_tmp
外,所有表都没有错误移动,该表具有to_date
函数。
我最终遇到了这个错误:
无法用格式'yyyymmdd'
分析日期'
我对为什么会发生这种情况感到不知所措,我尝试了try_t try_to_to_date
,因为<<<<代码> SEXITION_TMP 表具有加载数据的标题。
查询:
INSERT INTO precipitation(date_t, precipitation, precipitation_normal)
SELECT
TO_DATE(date_tmp,'YYYYMMDD'),
CAST(precipitation_tmp AS FLOAT),
CAST(precipitation_normal AS FLOAT)
FROM
"UDACITYPROJECT"."STAGING".precipitation_tmp;
这是针对学校项目的。
I've loaded my data into staging, which went smoothly across the board, but now when trying to insert my data from staging into the ods my sql errors out. All tables moved without error with the exception of temperature_tmp
and precipitation_tmp
, which have the TO_DATE
function.
I end up getting this error:
Can't parse 'date' as date with format 'YYYYMMDD'
I'm at a loss as to why this is happening, I tried TRY_TO_DATE
and that threw a different error because the first row of the precipitation_tmp
table has the headers from loading the data.
Query:
INSERT INTO precipitation(date_t, precipitation, precipitation_normal)
SELECT
TO_DATE(date_tmp,'YYYYMMDD'),
CAST(precipitation_tmp AS FLOAT),
CAST(precipitation_normal AS FLOAT)
FROM
"UDACITYPROJECT"."STAGING".precipitation_tmp;
This is for a school project.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
找到了我的问题,并审查了我的代码。我错过了
skip_header = 1
在我的副本结束时...谢谢您的洞察力,感谢您的帮助Found my problem, and reviewed my code. I missed the
skip_header=1
at the end of my copy into line... Thank you for the insight Jim, appreciate the help