读书人

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

发布时间: 2012-01-23 21:57:28 作者: rapoo

如何查出小数点后两位不为零的数据?
如题,如何查出小数点后两位以上不为零的数据?
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
*/

读书人网 >SQL Server

热点推荐