本文介绍了如何仅获取数字列值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用 SQL Server 2005
Using SQL Server 2005
我只想从表格中获取数值
I want to get only numeric values from the table
第一列
12345
asdf
2312
ase
acd
...,
尝试查询
Select Isnumeric(column1) from table
显示结果
1
0
1
0
0
..,
我需要 colum1 数值
I need the colum1 numeric value
需要 SQL Server 查询帮助
Need SQL Server Query help
推荐答案
SELECT column1 FROM table WHERE ISNUMERIC(column1) = 1
请注意,正如Damien_The_Unbeliever 指出的,这将包括任何有效的数字类型.
Note, as Damien_The_Unbeliever has pointed out, this will include any valid numeric type.
要过滤掉包含非数字字符(和空字符串)的列,您可以使用
To filter out columns containing non-digit characters (and empty strings), you could use
SELECT column1 FROM table WHERE column1 not like '%[^0-9]%' and column1 != ''
这篇关于如何仅获取数字列值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!