我要判断SQL-SERVER数据库下的FFFF数据库下的数据表T-BUS 是否存在,我写的代码如下,不知错在哪里,请指教
if exist(select * from sysobjects where name=t-BUS And xtype='u') then
如何改正,请帮助一下
if exist(select * from sysobjects where name=t-BUS And xtype='u') then
如何改正,请帮助一下
--不要 then
if exist(select * from sysobjects where name=t-BUS And xtype='u') then
改为:
if exist(select * from sysobjects where name='t-BUS' And xtype='u') then
Query1.SQL.Text:='if exists (select * from dbo.sysobjects where id = object_id(N'''[dbo].[t-BUS]''') and OBJECTPROPERTY(id, N'''IsUserTable''') = 1) select * from t-bus';
try
Query1.Open;
except
end;应该行了吧。