SSIS 无法确定列的正确数据类型
我有一个简单的 SSIS 包,它从 Oracle 数据库中选取数据并将数据插入到 sql server 中。在 DataFlow 中,我有 3 个任务:
- 我有一个运行非常简单查询的 OLE DB 源。选择 表中的 Col1、Col2、Col3、Col4、Col5、Col6、Col7。
- 然后我有一个数据转换任务来转换 col6 和 col7 从 unicode STRING[DT_WSTR] 到 STRING[DT_STR]。
- OLE DB 目标(sql 服务器)。
错误:SSIS 将 OLE DB 源任务变为红色并显示 以下错误:
输出“OLE DB”上的输出列“Col3”(23) 出现错误 源输出”(11)。返回的列状态为:“文本为 被截断或者一个或多个字符在目标代码中不匹配 页。”。
“输出列“Col3”(23)”因发生截断而失败, 以及“输出列“OS_VISIT_ID”上的截断行配置 (23)" 指定截断失败。截断错误发生在 指定组件的指定对象。
但 Col3 不是文本,它是数字,SSIS 将其检测为 unicode STRING[DT_WSTR]。 我什至尝试在数据转换任务中将 Col3 转换为数字,然后再转到 OLE DB 目标。但我仍然遇到同样的错误。
I have a simple SSIS package that picks data from Oracle database and inserts data to sql server. In DataFlow I have 3 tasks:
- I have a OLE DB source that runs a very simple query. Select
Col1, Col2, Col3, Col4, Col5, Col6, Col7 From Table. - Then I have a Data conversion task that converts col6 and
col7 from unicode STRING[DT_WSTR] to STRING[DT_STR]. - OLE DB Destination(sql server).
ERROR: SSIS turns the OLE DB Source Task to Red and displays the
following error:There was an error with output column "Col3" (23) on output "OLE DB
Source Output" (11). The column status returned was: "Text was
truncated or one or more characters had no match in the target code
page.".The "output column "Col3" (23)" failed because truncation occurred,
and the truncation row disposition on "output column "OS_VISIT_ID"
(23)" specifies failure on truncation. A truncation error occurred on
the specified object of the specified component.
But Col3 is not text its a Number, and SSIS is detecting it as unicode STRING[DT_WSTR].
I even tried to convert Col3 to Numeric in Data Conversion task before it goes to OLE DB Destination. But I still get the same error.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
单击错误输出 - 选择截断,然后选择重定向行。然后在源后面添加一个 Union 阶段,以将常规输出与“错误”行连接起来。将数据查看器附加到错误行并查看它抱怨的数据类型。现在它将正常运行任务。
PS:一些奇怪的提供商驱动程序要求您这样做,即使它本身永远不会“失败”。例如,Acucorp XBDC 驱动程序(读取一些奇怪的 db 格式平面文件) - 如果您不设置错误输出,将会失败,即使一旦您配置了错误行,每一行都会经过正常输出。
Click Error Output - choose truncation, and select redirect row. Then add a Union stage after the source to connect both the regular output with the "error" rows. Attach a data viewer to the error line and see what kind of data it's complaining on. It will now run the task as normal.
PS: Some oddball provider drivers -require- you to do this, even though it never "fails" per se. For example Acucorp XBDC drivers (that read some strange db format flat files) - will fail if you don't setup an error output, even though every row will go through the normal output once you have the error row configured.