SQL: Check if Table Exists and Drop if it Does

5/9/2018 9:06:41 PM

SQL

Check if a table exists and drop the table if it is found. This requires alter schema permissions.

if exists (select * from dbo.sysobjects where id = object_id('[dbo].My_Table_Name')
and OBJECTPROPERTY(id,'IsUserTable') = 1) DROP TABLE My_Table_Name