您好,欢迎访问一九零五行业门户网

判断数据库中是否存在表

1。sqlite 数据库: select count(*) from sqlite_master where table=*** sqlite_master 是 sqlite维护的系统表 2。sqlserver2000数据库 if exists(select 1 from sysobjects where name='表名' and xtype='u') print '存在' else print '不存在' 3。sqlser
1。sqlite 数据库:
select count(*) from sqlite_master where table=***
 sqlite_master  是 sqlite维护的系统表
2。sqlserver2000数据库
if   exists(select   1   from   sysobjects   where   name='表名'   and   xtype='u')  
  print   '存在'  
  else   
  print   '不存在'
3。sqlserver2005数据库
select   isnull(objectproperty(object_id('tablename'),   'isusertable'),   0)
存储过程中可以这样判断:
if object_id ('tablename', 'u') is not null
4。access数据库
 select count(*) as rtab from msysobjects where (((msysobjects.name) like 需判断的已知表名));
5。mysql数据库
select   1   from   information_schema.tables   where   table_name   =   'account';
if   found_rows()   =   1   then
....
end   if;
其它类似信息

推荐信息