日期:2014-05-16  浏览次数:20427 次

删除表判断是否存在[转]

MySQL:

DROP TABLE IF EXISTS [table_name]

?

Oracle:

BEGIN
EXECUTE IMMEDIATE 'DROP TABLE [table_name]';
EXCEPTION WHEN OTHERS THEN NULL;
END;

?

SQL Server:

IF EXISTS (
SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME = '[table_name]')
DROP TABLE [table_name]