Tools: String Manipulations Find Dupes My IP Json Formatter Lorem Ipsum More...
Discussion Options
ajax animation

SQL: Check if Table Exists and Drop if it Does


5/9/2018 5:06:41 PM by: CodeLocker

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

View Copy: Content Copied
if exists (select * from dbo.sysobjects where id = object_id('[dbo].My_Table_Name')
and OBJECTPROPERTY(id,'IsUserTable') = 1) DROP TABLE My_Table_Name
Copy: Content Copied
ajax animation

Get Coding

Store your first code or add more code to your collection.
You must login to report abuse. ×