您的位置:首页 > 数据库

查询数据库指定表是否存在

2016-02-02 11:31 405 查看
MYSQL:

select count(*) as tabcount from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='dbname()' and TABLE_NAME='tablename‘

MSSQL:

select count(*) as tabcount from tempdb.dbo.sysobjects where id = object_id(N'tablename') and type='U'

ORACLE:

select count(*) as tabcount from dba_tables where table_name='tablename'

DB2:

select count(*) as tabcount from syscat.tables where tabname = upper('tablename')

SYBASE:

select count(*) as tabcount from sysobjects where name='tablename' and type='U'

DM:

select count(*) as tabcount from sysobjects where name='tablename' and type='U'
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: