Posted By

hoffstein on 10/14/08


Tagged

tsql


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

hoffstein


TSQL delete table if it already exists


 / Published in: SQL
 

  1. IF EXISTS (
  2. SELECT 1 FROM INFORMATION_SCHEMA.TABLES
  3. WHERE TABLE_NAME = 'MyTable' AND TABLE_SCHEMA = 'dbo'
  4. )
  5. BEGIN
  6. DROP TABLE dbo.MyTable
  7. PRINT 'Dropped dbo.MyTable'
  8. END

Report this snippet  

You need to login to post a comment.