SQL Division在SSRS中显示为null

问题描述 投票:0回答:1

我正在尝试在SQL中进行一些划分并将其放入SSRS表对象。

此SQL有效,并且结果为0.6

select testcol2/5 testcol from (select 3 testcol2 from dual)

enter image description here

但是当我尝试进行其他处理(因此用列划分)时,SSRS表显示无值而不是1.6:

select  5/testcol2 testcol from (select 3 testcol2 from dual)

enter image description here

[有人可以帮助我如何获得SSRS来显示1.6值吗?

sql oracle reporting-services ssrs-2012 reportbuilder3.0
1个回答
0
投票

这很奇怪,但是我能够复制它。当我在其他工具中运行SQL时,可以确认结果为1.666666...,但SSRS未显示它。

这里是有效的解决方案。更改SQL以将结果取整:

select ROUND(5/testcol2, 2) as testcol2 
from (select 3 testcol2 from dual)

现在SSRS将按预期显示1.67。它将照常使用您在文本框中放置的所有其他数字格式。

编辑:为了满足我的好奇心,我多挖了一点。我在Oracle中使用dump函数来确定它使用的长度为193。如果您舍入最多28个小数位,则此功能有效。除此之外,SSRS不会显示该值。

© www.soinside.com 2019 - 2024. All rights reserved.