不太好弄!
比如:a1长度为5那么就是
var
i:integer;
sqltext,s:string;
begin
s:='and ';
for i:=1 to 5 do
begin
s:=s+copy(a1,i,1)<>'1' and ....copy(a1,i,1)<>'9';
end;
sqltext:='select * from a where True %s';
if ADOQuery1.active then ADOQuery1.close;
ADOQuery1.sql.text:=format(sqltext,);
ADOQuery1.open;
end;
随手写的,你试试吧!
B. 使用 ISNUMERIC 和 SUBSTRING
下面的示例对于 titles 表中的所有书名都返回 0,这是因为没有一个书名是有效的数值。
USE pubs
GO
-- Because the title column is all character data, expect a result of 0
-- for the ISNUMERIC function.
SELECT SUBSTRING(title, 1, 15) type, price, ISNUMERIC(title)
FROM titles
GO