DT_Decimal数据类型截断十进制

时间:2022-01-03 16:17:22

I have a flat file source that grabs a decimal value for the column Note Amount. The Source system specifies that this is a DECIMAL(12,2) file. I have the column in SSIS set to be DT_Decimal

我有一个平面文件源,它可以获取注释金额列的十进制值。 Source系统指定这是DECIMAL(12,2)文件。我将SSIS中的列设置为DT_Decimal

DT_Decimal数据类型截断十进制

The particular Flat file has a value of 122735.13 for one of it's amounts. However if I place a data viewer on the flow after the source it seems to be cutting the decimal off.

其中一个数量的特定Flat文件的值为122735.13。但是,如果我在数据源之后放置数据查看器,它似乎正在减少小数。

DT_Decimal数据类型截断十进制

DT_Decimal数据类型截断十进制

Any idea why this is happening? For reference I'm going to a Decimal(12,2) SQL Server 2012 Database.

知道为什么会这样吗?作为参考,我将使用Decimal(12,2)SQL Server 2012数据库。

2 个解决方案

#1


21  

Well it was pointed out that I needed to add the Scale that was missing.

有人指出,我需要添加缺少的比例。

DT_Decimal数据类型截断十进制

Or even better do as this suggests and switch to numeric where I can set precision and scale.

或者甚至更好,因为这表明并切换到数字,我可以设置精度和比例。

DT_Decimal数据类型截断十进制

#2


-2  

I ended up with reading it as text and alterering the table field to decimal before and after import. No other way let me keep the deciaml point in SSIS 2013.

我最终将其作为文本读取,并在导入之前和之后将表字段更改为十进制。没有其他办法可以让我保持SSIS 2013中的deciaml点。

#1


21  

Well it was pointed out that I needed to add the Scale that was missing.

有人指出,我需要添加缺少的比例。

DT_Decimal数据类型截断十进制

Or even better do as this suggests and switch to numeric where I can set precision and scale.

或者甚至更好,因为这表明并切换到数字,我可以设置精度和比例。

DT_Decimal数据类型截断十进制

#2


-2  

I ended up with reading it as text and alterering the table field to decimal before and after import. No other way let me keep the deciaml point in SSIS 2013.

我最终将其作为文本读取,并在导入之前和之后将表字段更改为十进制。没有其他办法可以让我保持SSIS 2013中的deciaml点。