如何在SQL Server Integration Services中停止舍入值?

时间:2022-06-17 16:52:48

I'm using the SSIS package, there is nothing being changed from source to destination. However, the column which I'm paying attention right now has a slightly different datatype (which I hope doesn't matter) in the source and destination; the source has numeric (15,2) and the destination has numeric (16,2) and the data in the source is 4.75 and it changes to 5.

我正在使用SSIS包,从源到目的地没有任何变化。但是,我现在关注的列在源和目标中具有稍微不同的数据类型(我希望无关紧要);源有数字(15,2),目标有数字(16,2),源中的数据是4.75,它变为5。

The 1 digit reduction in the decimal places, which I'm sure, should not matter because I tested with the case.

我确定,小数位的1位数减少应该不重要,因为我测试了这个案例。

Why is the value rounded?

为什么价值四舍五入?

4 个解决方案

#1


There is obviously some important piece of information you are leaving out.

显然,您要遗漏一些重要信息。

Have you looked at the data in the flow in a dataviewer to see where the change occurs?

您是否查看了数据查看器中流中的数据以查看更改发生的位置?

#2


Check the advanced editors of every task in the data flow (right click the task-->Show Advanced Editor). Go to the columns tab, and check the External, Input, and Output columns to make sure your column is never an integer.

检查数据流中每个任务的高级编辑器(右键单击任务 - >显示高级编辑器)。转到“列”选项卡,然后选中“外部”,“输入”和“输出”列以确保列永远不是整数。

My guess is you're pulling it as an integer (on the source), not as a numeric.

我的猜测是你把它作为整数(在源上),而不是数字。

#3


Agreed. There's something missing. Any chance you're doing some sort of operation (e.g. multiplication) by a constant integer somewhere (multiplying by 5 instead of 5.0) ?

同意。有些东西不见了。你有没有机会在某个地方用一个常数整数进行某种操作(例如乘法)(乘以5而不是5.0)?

#4


I also had the same problem. There seems to be a bug in BIDS. My OLE DB task was previously set to have a price as an int. Realising my mistake I changed it to money but BIDS/SSIS kept rounding it and treating it as an INT. I tried everything and in the end the only thing to solve this was to delete the OLE DB task and drag a new one on. I used the same query, but with money and it worked fine. It's like BIDS/SSIS has a strange 'memory' and the only way round it is to start again!

我也有同样的问题。 BIDS似乎有一个错误。我的OLE DB任务以前设置为具有int的价格。意识到我的错误,我把它变成了金钱,但是BIDS / SSIS不断将它变成圆形并将其视为INT。我尝试了一切,最后解决这个问题的唯一方法就是删除OLE DB任务并拖动一个新任务。我使用相同的查询,但有钱,它工作正常。这就像BIDS / SSIS有一个奇怪的“记忆”,唯一的方法是重新开始!

#1


There is obviously some important piece of information you are leaving out.

显然,您要遗漏一些重要信息。

Have you looked at the data in the flow in a dataviewer to see where the change occurs?

您是否查看了数据查看器中流中的数据以查看更改发生的位置?

#2


Check the advanced editors of every task in the data flow (right click the task-->Show Advanced Editor). Go to the columns tab, and check the External, Input, and Output columns to make sure your column is never an integer.

检查数据流中每个任务的高级编辑器(右键单击任务 - >显示高级编辑器)。转到“列”选项卡,然后选中“外部”,“输入”和“输出”列以确保列永远不是整数。

My guess is you're pulling it as an integer (on the source), not as a numeric.

我的猜测是你把它作为整数(在源上),而不是数字。

#3


Agreed. There's something missing. Any chance you're doing some sort of operation (e.g. multiplication) by a constant integer somewhere (multiplying by 5 instead of 5.0) ?

同意。有些东西不见了。你有没有机会在某个地方用一个常数整数进行某种操作(例如乘法)(乘以5而不是5.0)?

#4


I also had the same problem. There seems to be a bug in BIDS. My OLE DB task was previously set to have a price as an int. Realising my mistake I changed it to money but BIDS/SSIS kept rounding it and treating it as an INT. I tried everything and in the end the only thing to solve this was to delete the OLE DB task and drag a new one on. I used the same query, but with money and it worked fine. It's like BIDS/SSIS has a strange 'memory' and the only way round it is to start again!

我也有同样的问题。 BIDS似乎有一个错误。我的OLE DB任务以前设置为具有int的价格。意识到我的错误,我把它变成了金钱,但是BIDS / SSIS不断将它变成圆形并将其视为INT。我尝试了一切,最后解决这个问题的唯一方法就是删除OLE DB任务并拖动一个新任务。我使用相同的查询,但有钱,它工作正常。这就像BIDS / SSIS有一个奇怪的“记忆”,唯一的方法是重新开始!