简单实用的Oracle/SQL Server/SQLite 判断某张表是否存在的SQL语句。
1.Oracle
SELECT COUNT(*) as count
FROM all_tables
WHERE table_name= 'tablename'
不存在返回0
2.Sqlserver
SELECT COUNT(*)
FROM sys.objects
WHERE object_id = OBJECT_ID(N'tablename') AND type in (N'U')
不存在放回0
3.Sqlite
SELECT COUNT(*) as count
FROM sqlite_master
WHERE type='table' and name= 'tablename'
不存在放回0