Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dropping a group of tables in SQL Server

Is there a simple way to drop a group of interrelated tables in SQL Server? Ideally I'd like to avoid having to worry about what order they're being dropped in since I know the entire group will be gone by the end of the process.

like image 481
Matt Sheppard Avatar asked Aug 11 '08 04:08

Matt Sheppard


1 Answers

At the risk of sounding stupid, I don't believe SQL Server supports the delete / cascade syntax. I think you can configure a delete rule to do cascading deletes (http://msdn.microsoft.com/en-us/library/ms152507.aspx), but as far as I know the trick with SQL Server is to just to run your drop query once for each table you're dropping, then check it worked.

like image 166
Jon Galloway Avatar answered Oct 19 '22 04:10

Jon Galloway