/ Published in: SQL
It removes relations before deleting tables.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
SELECT 'ALTER TABLE ' + OBJECT_NAME(parent_object_id) + ' DROP CONSTRAINT ' + name FROM sys.foreign_keys EXEC sp_MSforeachtable @command1 = "DROP TABLE ?"