Posted By

fixpq on 02/17/13


Tagged

sql delete tables


Versions (?)

Delete all tables from SQL


 / Published in: SQL
 

It removes relations before deleting tables.

  1. SELECT
  2. 'ALTER TABLE ' + OBJECT_NAME(parent_object_id) +
  3. ' DROP CONSTRAINT ' + name
  4. FROM sys.foreign_keys
  5.  
  6. EXEC sp_MSforeachtable @command1 = "DROP TABLE ?"

Report this snippet  

You need to login to post a comment.