【发布时间】:2017-06-24 16:16:56
【问题描述】:
我有一个这样的代码查询。
set @CurrentPatchDeployPercentage = convert(numeric(5,2), (isnull(@LastMonthDeployCount, 0)* 100.00 / isnull(nullif(@TotalMachines, 0), 1)))
但是当我运行时出现以下错误,请帮助。
将数字转换为数据类型数字的算术溢出错误
【问题讨论】:
-
numeric(5,2) 允许总共 5 个数字,2 个小数表示 5 - 2 = 左边的总共 3 个数字。您的计算结果超过 999.99 并引发错误。增加 numeric() 的大小
-
您可以尝试将 numeric(5,2) 增加到 numeric(x,y),其中 x,y 相对高于您指定的值
-
大家好,我将值增加到 numeric(6,3) 但仍然是同样的错误
标签: sql-server sql-server-2008