从分段中插入我的ODS,在我的日期列时会出现错误,我该更改代码?

发布于 2025-02-14 01:17:11 字数 673 浏览 0 评论 0原文

我已经将数据加载到了舞台上,该分段整体上都顺利进行,但是现在,当试图将数据插入到ODS中时,我的SQL错误。除温度_tmpstecitation_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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

吻泪 2025-02-21 01:17:12

找到了我的问题,并审查了我的代码。我错过了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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文