Check for existence before dropping
suggest changeDROP TABLE IF EXISTS is widely supported:
DROP TABLE IF EXISTS MyTable;
This procedural check is SQL Server syntax:
IF EXISTS(SELECT * FROM Information_Schema.Tables
WHERE Table_Schema = 'dbo'
AND Table_Name = 'MyTable')
DROP TABLE dbo.MyTable
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents