SSIS中的划分与SQL Server中的划分不同 [英] Division in SSIS differs that in SQL server
问题描述
你好朋友,
我正在从excel导入数据,并在将数据转储到目标表中之前在REV
列上执行派生列.
我的问题是,假设该列包含6180.00
,并且我在派生列中编写表达式,如下所示
Hello friends,
I''m importing data from excel and performing derived column on REV
column before dumping the data in the destination table.
My problem is, suppose the column contains 6180.00
and I write expression in derived column as below
6180.00 / 1000
它给了我6.17
作为输出
但是,如果我尝试在SQL Server中进行跟踪
It gives me 6.17
as output
But if i try following in SQL Server
select 6180.00/1000
它给了我6.1800000
作为输出
我能知道发生了什么事,为什么
我想要的最终结果是6.18
知道怎么做吗?
在此先感谢
It gives me 6.1800000
as output
Can I know what is happening and why
What i want as final result is 6.18
Any idea how to do it?
Thanks in advance
推荐答案
所以我要做的是,我迫使SSIS计算出更高的精度值,然后将其绕到我想要的精度.
所以下面给了我所需的输出
So what I did is, I would force SSIS to compute higher precision value and then ROUND it to the precision I want.
So following gave me required output
ROUND(((DT_DECIMAL,4)[REV]) / ((DT_DECIMAL,4)1000),2)
希望这对Yu有帮助:)
Hope this helps Yu :)
这篇关于SSIS中的划分与SQL Server中的划分不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!