我想执行如下算术运算:
select 99999999999999999999999999999999999999 * 256
但是,这会导致错误
将表达式转换为数值类型的算术溢出错误。
如何执行算术运算以返回精度大于38的值?
答案 0 :(得分:1)
您可以使用float-但请先阅读以下出色答案:
Difference between numeric, float and decimal in SQL Server
declare @x float = 99999999999999999999999999999999999999;
declare @y float = 256;
select @y*@x
否则,十进制(38,0)是唯一保留9999 .....
declare @x decimal(38,0) = 99999999999999999999999999999999999999;