加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > MsSql教程 > 正文

SQLServer Round()函数

发布时间:2020-12-12 14:06:17 所属栏目:MsSql教程 来源:网络整理
导读:环境:SQLServer 2005 Express 1 select?? cast(round(6562.5,0)?? as?? int) --result:6563 2.select?? round(4687.5,0),round(6562.5,0) --result:4688.0, 6563.0 3.select?? round(6562.523,2) --result:6562.520 4. select?? round(6562.523,-2) --re

环境:SQLServer 2005 Express

1 select?? cast(round(6562.5,0)?? as?? int)

--result:6563
2.select?? round(4687.5,0),round(6562.5,0)

--result:4688.0, 6563.0

3.select?? round(6562.523,2)

--result:6562.520

4. select?? round(6562.523,-2)

--result:6600.000

round函数四舍五入,它不会减小小数位数如:6562.523 它只会把后面的3用0代替。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读