Delete all tables from SQL


/ Published in: SQL
Save to your folder(s)

It removes relations before deleting tables.


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.