查询数据库指定表是否存在
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'
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'
相关文章推荐
- SQL分页查询,纯Top方式和row_number()解析函数的使用及区别
- 一. Redis 常用命令
- 一. Redis 常用命令
- SQL中print、sp_helptext的限制与扩展
- 几个不太常用的sql
- Java程序员在用的大数据工具,MongoDB稳居第一!
- 数据库相关英语翻译(1)
- SQL SERVER修改函数名容易引发的问题分析
- mysql max_allowed_packet查询和修改
- 清除SQL数据库日志
- sql server 审核
- mongodb 对地理位置坐标的计算
- SQLiteDatabase.openOrCreateDatabase(file, factory)和file间的冲突问题
- Redis概述
- go 调用sqlite
- linux下 oracle常用命令
- sqlserver 游标的使用
- mysql字符串相关
- go 调用mysql
- Sql操作之一:备份和还原