首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

Select的简单有关问题!待!解决马上结帖

2012-02-10 
Select的简单问题!在线等待!解决马上结帖表A中有一个字段B,B中只要有除数字以外的串,就全部显示出来!请问S

Select的简单问题!在线等待!解决马上结帖
表A中有一个字段B,B中只要有除数字以外的串,就全部显示出来!请问SQL怎么写

[解决办法]
select * from A where patindex( '%[^0-9]% ',B)> 0
[解决办法]
select *
from 表A
where ISNUMERIC(isnull(字段B, 'a '))=0
[解决办法]
select b from a where isnumeric(b) <> 1
[解决办法]
select * from A where isnumeric(isnull(b, '哈哈 '))=0
[解决办法]
create or replace function isNumber(p_in varchar2) return varchar2 as
i number;
begin
i:=to_number(p_in);
return 'TRUE ';
exception
when others then
return 'FALSE ';
end ;

--oracle中没有函数 你要自己建一个函数


select *
from 表A
where isNumber(字段B)= 'FALSE '

[解决办法]
SQL> create table my(name varchar2(20));

Table created.

SQL> insert into my select '1 ' from dual;

1 row created.

SQL> insert into my select '2 ' from dual;

1 row created.

SQL> insert into my select 'abc ' from dual;

1 row created.


SQL> select * from my where trim(translate(name, '0123456789 ', ' ')) is null;

NAME
--------------------
1
2
[解决办法]
楼上的解决了~
[解决办法]
select * from my where trim(translate(name, '0123456789 ', ' ')) is not null;

热点排行