各位大哥:
现求一简章SQl语句!
现假设有一SQl数据库中有一表Gather_office_fee
现在要判断此表存在,在Delphi中应该怎么写!
var
key:string;
......
if Exists('select * from dbo.sysobjects where id= object_id(N[dbo].[Gather_office_fee]') then
key:='有表'
else
key:='没表';
end;
但是我在用的时候出现一个错误:
Undeclared indentifier:'exists'
请求哪位能将完整的写一下!
30分钟后结贴!
现求一简章SQl语句!
现假设有一SQl数据库中有一表Gather_office_fee
现在要判断此表存在,在Delphi中应该怎么写!
var
key:string;
......
if Exists('select * from dbo.sysobjects where id= object_id(N[dbo].[Gather_office_fee]') then
key:='有表'
else
key:='没表';
end;
但是我在用的时候出现一个错误:
Undeclared indentifier:'exists'
请求哪位能将完整的写一下!
30分钟后结贴!
tbNames : TStringList;
begtin
tbNames := TStringList.Create;
ADOConnection1.GetTableNames(tbNames);
if tbNames.IndexOf('Gather_office_fee') <> -1 then
Key := '没表'
else
Key := '有表';
end;
ssql,key;string;
begin
query.close;
query.sql.clear;
query.sql.add('select * from dbo.sysobjects where name=''Gather_office_fee''');
query.open;
if query.isempty then
key :='有表''
else
key :='没表';
end;