检索纯数字,这样的sql怎么写?

pen_scholar 2009-05-22 04:41:31
判断表t_a的col_1列中值必须是数字0-9,
当有不全是数字的列存在时,将其检索出
这样的sql怎么写?
...全文
168 15 打赏 收藏 转发到动态 举报
写回复
用AI写文章
15 条回复
切换为时间正序
请发表友善的回复…
发表回复
kingdomxpxp 2009-05-22
  • 打赏
  • 举报
回复
.
hery2002 2009-05-22
  • 打赏
  • 举报
回复
.
寻找Python之禅 2009-05-22
  • 打赏
  • 举报
回复
来迟了,没我份了
soft_wsx 2009-05-22
  • 打赏
  • 举报
回复
没话说了
fuda_1985 2009-05-22
  • 打赏
  • 举报
回复
只一个字,顶~都说出来了.
JonasFeng 2009-05-22
  • 打赏
  • 举报
回复
[Quote=引用 7 楼 you_tube 的回复:]
SQL codeselect 1 from tab where patindex('%[a-z,A-Z]%',col1) > 0
[/Quote]

学习!
这个也OK!
select * from tb where where isnumeric(col)=1 and col between 1 and 9 


光宇广贞 2009-05-22
  • 打赏
  • 举报
回复
[Quote=引用 8 楼 S468160201880427556 的回复:]
select case when ISNUMERIC(col_1)=1 then '数字' else '字符' end from t_a
[/Quote]

顶美女,数据库的专家啊。
  • 打赏
  • 举报
回复
select case when ISNUMERIC(col_1)=1 then '数字' else '字符' end from t_a
you_tube 2009-05-22
  • 打赏
  • 举报
回复
select 1 from tab where patindex('%[a-z,A-Z]%',col1) > 0
--小F-- 2009-05-22
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 fredrickhu 的回复:]
引用 3 楼 fredrickhu 的回复:
SQL codeselect col_1 from t_a where col_1 between 0 and 9

--不是0到9的话加上not
SQL codeselect col_1 from t_a where col_1 between 0 and 9
[/Quote]

SQL codeselect col_1 from t_a where col_1 not between 0 and 9
--小F-- 2009-05-22
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 fredrickhu 的回复:]
SQL codeselect col_1 from t_a where col_1 between 0 and 9
[/Quote]
--不是0到9的话加上not
select col_1 from t_a where col_1 between 0 and 9
angellan 2009-05-22
  • 打赏
  • 举报
回复
WHERE col NOT LIKE '%[0-9]%'
--小F-- 2009-05-22
  • 打赏
  • 举报
回复
select col_1 from t_a where col_1 between 0 and 9
百年树人 2009-05-22
  • 打赏
  • 举报
回复
--当有不全是数字的列存在时,将其检索出

select * from tb where where isnumeric(col)=0
百年树人 2009-05-22
  • 打赏
  • 举报
回复
where isnumeric(col)=1

34,872

社区成员

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

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