SSIS - 由于潜在的数据丢失,无法转换该值

2021-12-30 00:00:00 etl oracle sql-server ssis

我对 SSIS 比较陌生.我正在尝试使用 Microsoft OLEDB for Oracle 从 Oracle 数据库中提取信息,我正在使用以下查询:

I am relatively new to SSIS. I am trying to extract information from an Oracle database using Microsoft OLEDB for Oracle and I am using this query:

SELECT ID FROM Test

我收到一条错误消息:由于潜在的数据丢失,无法转换该值.如果我将查询更改为以下内容,则它可以工作:

I get an error message saying: the value cannot be converted because of a potential loss of data. If I change the query to the following then it works:

SELECT '1' FROM Test

我认为它失败了,因为 ID 不是整数.但是,平面文件连接管理器显示 OutputColumnWidth 为 50.我做错了什么?

I think it is failing because the ID is not an integer. However, the flat file connection manager shows that the OutputColumnWidth is 50. What am I doing wrong?

格林威治标准时间 16:30 更新
我对此进行了更多研究,似乎是具有频率"或无"直方图的列导致了问题.具有高度平衡"直方图的那些似乎没问题.

Update 16:30 GMT
I have looked into this a little more and it appears to be the columns that have a Histogram of 'frequency' or 'none' that are causing the problems. Those with a Histogram of 'Height Balanced' appear to be OK.

推荐答案

这是很常见的事情.在很多情况下,从无法确定列元数据的另一种类型的系统导入 ssis 的默认设置是默认为 str(50).由于您试图将其推送到一个字符列中,因此它假定您可能会丢失数据.只需通过右键单击并选择显示高级编辑器..."进入源组件

This is a common thing. The default in a lot of cases for imports into ssis from another type of system where metadata for columns cannot be determined is to default to str(50). Since you are trying to push that into a one character column, it assumes that you may lose data. Simply go into the source component by right clicking and choosing "Show Advanced editor..."

然后导航到最后一个选项卡(输入和输出属性)

Then navigate to the last tab (Input and Output Properties)

单击 OLE DB Source Output 旁边的 +

Click the + next to OLE DB Source Output

点击输出列旁边的 +

突出显示 ID 列

滚动到对话框右侧的长度数据类型属性并将其从 50 更改为 1.

Scroll to the Length Data Type Property on the right of the dialog box and change it from 50 to 1.

相关文章