首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

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

2012-01-23 
如何查出小数点后两位不为零的数据?如题,如何查出小数点后两位以上不为零的数据?a(numeric(9,4))123.1512.

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

热点排行