adocommand.sql.add('select name from sysobjects where xtype='U'
and name='+表名+')'
adocommand.requery();
if varisnull(adocommand.fieldbyname('name')) then
showmessage('No the table');
哈哈,好几种:
a. if exists ( select * from sysobjects where name='tablename')
b. SELECT count(TABLE_NAME) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'T1'
c、if exists (select * from sysobjects where id = object_id(N'[dbo].[demo]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
A肯定对,其他没验证。
直接在SQL的查询分析器运行就行了