請問如何判斷一個數是不是小數? 請大家把算法寫出來.
解决方案 »
- 索引问题
- sql2000 数据合并问题
- 请教老师:将文本字符逐个追加入表记录的方法或语句
- 为什么 CAST('Feb 19 1952 12:00AM' AS datetime) 失败?
- Mysql在win8上的问题,两天了还没解决,急
- sql server 2000 外键的 级联更新,检查现有数据,说明,是否级联更新,对复制强制关系这些信息在存在哪些系统表里啊
- MS SQL 式分布式数据库吗?支持集群技术吗?
- 资料管理系统,资料文件应该保存在什么地方为好?直接保存在数据库中?还是只保存文件地址?
- 触发器中如何取出不定列的列值?Trigger问题续
- ***查询时间的SQL语句***
- 如何在存储过程A内再声明一个子存储过程B
- 备份别人机子上的数据库问题
select * from tb where 列%1 <> 0 --小数
insert into tb values( '1 ', 'BJ ',10.05)
insert into tb values( '1 ', 'SH ',8)
insert into tb values( '1 ', 'GZ ',2)
insert into tb values( '2 ', 'BJ ',1.3)
insert into tb values( '2 ', 'SH ',3.2)
go--小数
select *
from tb
where cast(substring(cast(proprice as varchar),charindex('.',cast(proprice as varchar))+1,len(cast(proprice as varchar))) as int) <> 0
/*
proid proarea proprice
----------- ---------- --------------------
1 BJ 10.05
2 BJ 1.30
2 SH 3.20(所影响的行数为 3 行)
*/--整数
select *
from tb
where cast(substring(cast(proprice as varchar),charindex('.',cast(proprice as varchar))+1,len(cast(proprice as varchar))) as int) = 0
/*
proid proarea proprice
----------- ---------- --------------------
1 SH 8.00
1 GZ 2.00(所影响的行数为 2 行)
*/drop table tb
print '是小数
只要满足这样条件的就是带小数位的
print 0