SQL怎么截取小数点前的数字,但是不要四舍五入
6个回答
展开全部
round(3.45) >>>>>3.5 4舍5入
ceil(3.45)>>>>>>4 最接近的较大整数(ceiling天花板的意思)
floor(3.45)>>>>>>3 最接近的较小整数(floor地板的意思)
ceil(3.45)>>>>>>4 最接近的较大整数(ceiling天花板的意思)
floor(3.45)>>>>>>3 最接近的较小整数(floor地板的意思)
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2015-01-06
展开全部
trunc(125.815) would return 125
trunc(125.815, 0) would return 125
trunc(125.815, 1) would return 125.8
trunc(125.815, 2) would return 125.81
trunc(125.815, 3) would return 125.815
trunc(-125.815, 2) would return -125.81
trunc(125.815, -1) would return 120
trunc(125.815, -2) would return 100
trunc(125.815, -3) would return 0
trunc(125.815, 0) would return 125
trunc(125.815, 1) would return 125.8
trunc(125.815, 2) would return 125.81
trunc(125.815, 3) would return 125.815
trunc(-125.815, 2) would return -125.81
trunc(125.815, -1) would return 120
trunc(125.815, -2) would return 100
trunc(125.815, -3) would return 0
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
substring(ID,1,(charindex('.',ID)-1)
从ID第一位开始截取 到 ‘.’前面的值
从ID第一位开始截取 到 ‘.’前面的值
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
round(数值,位数,截取1如四射五入默认0或不填)
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询