当前位置: 代码迷 >> Sql Server >> 怎么查出小数点后两位不为零的数据
  详细解决方案

怎么查出小数点后两位不为零的数据

热度:31   发布时间:2016-04-27 20:08:20.0
如何查出小数点后两位不为零的数据?
如题,如何查出小数点后两位以上不为零的数据?
a(numeric(9,4))
123.15
12.0
100
356.545
123.45

查出结果应该如下
123.15
356.545
123.45

------解决方案--------------------
select *
from 表名
where round(a,0) <> a
------解决方案--------------------
declare @t table(a numeric(9,4))
insert @t
select 123.15 union all
select 12.0 union all
select 100 union all
select 356.545 union all
select 123.45

----查询
select * from @t where floor(a*10) <> a*10


/*结果
a
-----------
123.1500
356.5450
123.4500
*/
  相关解决方案