注册 登录
编程论坛 ASP技术论坛

mssql2000 查询某个字段值不为ip条件怎么写

sky222 发布于 2012-03-23 11:31, 434 次点击
mssql2000 查询某个字段值不为ip条件怎么写
表 table
id  a  b             c
1   a  a             a
2   a  127.0.0.1     c
3   a  157.0.17.4    c
4   b  c             a

select * form table where b  怎么写

查询出来的内容是
1  a  a  a
4  b  c  a
3 回复
#2
yms1232012-03-23 11:57
可以这样试试呢?
select * form table where b like '[0-9].[0-9].[0-9].[0-9]'
用like查询必须是这种数字组合的字符串
#3
sky2222012-03-23 12:02
已找到解决办法,

select * form table where  ISNUMERIC(replace(b,'.',''))=0
#4
sky2222012-03-23 12:02
谢谢版主
1