您好,欢迎访问一九零五行业门户网

保留十位有效数字

sql四舍五入保留浮点数的十位有效数字 无 declare @execsql nvarchar(1024)set @execsql =n'select cast('+cast(125.365412354 as nvarchar(20)) +n' as numeric (20,'+str(10-ceiling(log10(125.365412354)))+n'))'exec sp_executesql @execsql /*round?(?nu
sql四舍五入保留浮点数的十位有效数字 declare @execsql nvarchar(1024)set @execsql =n'select cast('+cast(125.365412354 as nvarchar(20)) +n' as numeric (20,'+str(10-ceiling(log10(125.365412354)))+n'))'exec sp_executesql @execsql
/*round?(?numeric_expression?,?length?[?,function?]?)function?必须为?tinyint、smallint或?int。如果省略?function?或其值为?0(默认值),则将舍入?numeric_expression。如果指定了0以外的值,则将截断?numeric_expression。*/select?round(150.45648,?2);--保留小数点后两位,需要四舍五入select?round(150.45648,?2,?0);--保留小数点后两位,0为默认值,表示进行四舍五入select?round(150.45648,?2,?1);--保留小数点后两位,不需要四舍五入,这里除0以外都是有同样的效果select?round(150.45648,?2,?2);--保留小数点后两位,不需要四舍五入,这里除0以外都是有同样的效果--150.46000--150.45000--150.45000--150.45000
其它类似信息

推荐信息