JSON的选择未按查询四舍五入

时间:2019-01-31 15:09:27

标签: json sql-server

Microsoft SQL Server中的简单SQL查询:

  

SELECT ROUND(SUM(amount),2)AS'Amount'   来自accuroucherlines   哪里vid = 10000174

返回的结果正确舍入为712.72

但是,相同的查询带有'FOR JSON PATH'后缀时,会返回科学格式的数字,例如[{"Amount":7.127200000000000e+002}]

我实际上需要JSON格式的舍入值。为什么它不能按预期工作?

1 个答案:

答案 0 :(得分:0)

通过将数字转换为DECIMAL(18,2)来按下SQL以减少小数位:

    <Button>
      Here’s some text <Icon name=“smile” /> ...and more text after the icon
    </Button>

查询玩法:

    <button>
      Here’s some text <div class=“AN-EXTRA-DIV-WRAP”><svg id=“smile”>…</svg></div> ...and more text after the icon
    </button>