SSIS 2008:派生列将字符串转换为日期数据类型

发布于 2024-11-16 09:29:37 字数 1315 浏览 2 评论 0原文

我昨天让这个 SSIS 包正常工作,现在我得到了这个错误,并且一夜之间没有任何更改。

基本上我得到的字符串看起来像:yyyymmdd,我需要将其转换为日期数据类型。因此,我采用子字​​符串来获取 yyyy/mm/dd,然后将其转换为日期类型。

路径:

平面文件源 --->衍生柱--->我所有的 SSIS 包集成/插入任务

以下是表达式:

(DT_DATE)(SUBSTRING([PolicyExpire],1,4) + "/" + SUBSTRING([PolicyExpire],5,6) + "/" + SUBSTRING([PolicyExpire],7,8))
(DT_DATE)(SUBSTRING([BirthDate],1,4) + "/" + SUBSTRING([BirthDate],5,6) + "/" + SUBSTRING([BirthDate],7,8))
(DT_DATE)(SUBSTRING([DLIssueDate],1,4) + "/" + SUBSTRING([DLIssueDate],5,6) + "/" + SUBSTRING([DLIssueDate],7,8))

这是错误:

提取 EXD 数据时出现错误:0xC0049064 从 Flatfile 到 YD db 1,派生 列 [3352]:发生错误 尝试执行类型转换。

提取 EXD 数据时出现错误:0xC0209029 从 Flatfile 到 YD db 1,派生 列 [3352]:SSIS 错误代码 DTS_E_INDUCEDTRANSFORMFAILUREONERROR。 “组件“派生列” (3352)”失败,因为错误代码 出现0xC0049064,且错误行 “输入列”上的配置 “PolicyExpire”(3368)”指定 错误失败。发生错误于 指定的指定对象 成分。可能有错误 在此之前发布的消息有更多 有关失败的信息。

提取 EXD 数据时出现错误:0xC0047022 从 Flatfile 到 YD db 1, SSIS.Pipeline:SSIS 错误代码 DTS_E_PROCESSINPUTFAILED。这 组件上的 ProcessInput 方法 “派生列”(3352) 失败 处理时出现错误代码 0xC0209029 输入“派生列输入”(3353)。 所识别的组件返回一个 来自 ProcessInput 方法的错误。 该错误特定于 组件,但错误是致命的并且 将导致数据流任务停止 跑步。可能会有错误信息 在此之前发布了更多内容 有关失败的信息。

I had this SSIS package working yesterday and now I'm getting this error with no changes overnight.

Basically I'm getting a String that looks like: yyyymmdd, I need to transform it into a Date Data Type. So I take substrings, to get yyyy/mm/dd then cast it into a Date Type.

The Path:

Flat File Source ---> Dervied Column ---> All my SSIS package intergration/insertion tasks

Here are the Expressions:

(DT_DATE)(SUBSTRING([PolicyExpire],1,4) + "/" + SUBSTRING([PolicyExpire],5,6) + "/" + SUBSTRING([PolicyExpire],7,8))
(DT_DATE)(SUBSTRING([BirthDate],1,4) + "/" + SUBSTRING([BirthDate],5,6) + "/" + SUBSTRING([BirthDate],7,8))
(DT_DATE)(SUBSTRING([DLIssueDate],1,4) + "/" + SUBSTRING([DLIssueDate],5,6) + "/" + SUBSTRING([DLIssueDate],7,8))

Here is the error:

Error: 0xC0049064 at Extract EXD data
from Flatfile into YD db 1, Derived
Column [3352]: An error occurred while
attempting to perform a type cast.

Error: 0xC0209029 at Extract EXD data
from Flatfile into YD db 1, Derived
Column [3352]: SSIS Error Code
DTS_E_INDUCEDTRANSFORMFAILUREONERROR.
The "component "Derived Column"
(3352)" failed because error code
0xC0049064 occurred, and the error row
disposition on "input column
"PolicyExpire" (3368)" specifies
failure on error. An error occurred on
the specified object of the specified
component. There may be error
messages posted before this with more
information about the failure.

Error: 0xC0047022 at Extract EXD data
from Flatfile into YD db 1,
SSIS.Pipeline: SSIS Error Code
DTS_E_PROCESSINPUTFAILED. The
ProcessInput method on component
"Derived Column" (3352) failed with
error code 0xC0209029 while processing
input "Derived Column Input" (3353).
The identified component returned an
error from the ProcessInput method.
The error is specific to the
component, but the error is fatal and
will cause the Data Flow task to stop
running. There may be error messages
posted before this with more
information about the failure.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(3

听不够的曲调 2024-11-23 09:29:37

您的子字符串参数对于日期的月份和日期部分不正确。

例如,应该是

SUBSTRING([PolicyExpire],5,2)

而不是

SUBSTRING([PolicyExpire],5,6)
获取月份值。

substring 函数的第三个参数是要查找的子字符串的LENGTH(在本例中为2),而不是子字符串的END POSITION。

试试这个

(DT_DATE)(SUBSTRING([PolicyExpire],1,4) + "/" + SUBSTRING([PolicyExpire],5,2) + "/" + SUBSTRING([PolicyExpire],7,2))

(DT_DATE)(SUBSTRING([BirthDate],1,4) + "/" + SUBSTRING([BirthDate],5,2) + "/" + SUBSTRING([BirthDate],7,2))

(DT_DATE)(SUBSTRING([DLIssueDate],1,4) + "/" + SUBSTRING([DLIssueDate],5,2) + "/"  + SUBSTRING([DLIssueDate],7,2))

Your substring paramaters are incorrect for the month and day portions of the date.

For example, it should be

SUBSTRING([PolicyExpire],5,2)

instead of

SUBSTRING([PolicyExpire],5,6)
to get the month value.

The third parameter of the substring function is the LENGTH of the substring to find (in this case 2), not the END POSITION of the substring.

Try this

(DT_DATE)(SUBSTRING([PolicyExpire],1,4) + "/" + SUBSTRING([PolicyExpire],5,2) + "/" + SUBSTRING([PolicyExpire],7,2))

(DT_DATE)(SUBSTRING([BirthDate],1,4) + "/" + SUBSTRING([BirthDate],5,2) + "/" + SUBSTRING([BirthDate],7,2))

(DT_DATE)(SUBSTRING([DLIssueDate],1,4) + "/" + SUBSTRING([DLIssueDate],5,2) + "/"  + SUBSTRING([DLIssueDate],7,2))
熊抱啵儿 2024-11-23 09:29:37

想必您今天尝试导入的数据有所不同。今天您的文本文件数据源是否存在昨天不存在的问题?

Presumably the data you are trying to import is different today. Is there a problem with your text file data source today that wasn't there yesterday?

聽兲甴掵 2024-11-23 09:29:37

上述转换不考虑 NULL。检查 [PolicyExpire] 记录之一中是否有 NULL 值。

The transformations above do not take into account NULLs. Check to see if [PolicyExpire] has a NULL value in one of the records.

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