Posted By

DaveChild on 09/11/08


Tagged

deletetable


Versions (?)

Who likes this?

4 people have marked this snippet as a favorite

Scooter
nublaii
ljayz
derekholmes


SQL Delete Table if Exists


 / Published in: SQL
 

  1. IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE table_name = 'TableToDelete') DROP TABLE TableToDelete

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: YanikLupien on April 6, 2009

DROP TABLE IF EXISTS TableToDelete

-- http://dev.mysql.com/doc/refman/5.1/en/drop-table.html

Posted By: derekholmes on January 28, 2011

also useful for testing temp table queries If Object_Id('tempdb..#easyResults') IS NOT NULL BEGIN DROP TABLE #easyResults END

You need to login to post a comment.