求sql语句

blackmeit 2008-03-13 07:01:06
有一列小数,保留了6位有效数据。
Units
2.000000
1.222000
1.200000
3123.231


我想查出多于一位小数的数据

期望结果:
Units
1.222000
3123.231


...全文
87 6 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
leisure_cool 2008-03-14
  • 打赏
  • 举报
回复

declare @table table (Units decimal(18,6))
insert into @table
select 2.000000
union all
select 1.222000
union all
select 1.200000
union all
select 3123.231

select * from @table where Units<> round(Units,2)
/*
或者
*/
select * from @table where Units<> round(Units,1)

dawugui 2008-03-13
  • 打赏
  • 举报
回复
create table tb(units  decimal(18,6))
insert into tb values(2.000000)
insert into tb values(1.222000)
insert into tb values(1.200000)
insert into tb values(3123.231)
go

select * from tb where (units * 100) - floor(units * 100) > 0

drop table tb

/*
units
--------------------
1.222000
3123.231000

(所影响的行数为 2 行)

*/
liuyann 2008-03-13
  • 打赏
  • 举报
回复

select *
from yourTable
where Units <> INT(Units )

== 思想重于技巧 ==
-狙击手- 2008-03-13
  • 打赏
  • 举报
回复
declare @t table(Units numeric(12,6))
insert @t select
2.000000 union select
1.222000 union select
1.200000 union select
3123.231

select *
from @t
where units <> round(units,1)
/*
Units
--------------
1.222000
3123.231000

(所影响的行数为 2 行)

*/
-狙击手- 2008-03-13
  • 打赏
  • 举报
回复
select *
from T
where units <> round(units,1)
JiangHongTao 2008-03-13
  • 打赏
  • 举报
回复
select units from tablename where right(rtrim(units),4)>'0000'

34,838

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧