How To Drop All Tables In An SQL Server Database

Read Time:15 Sec

I’ve been doing a lot of work with SQL Server lately and have found the following SQL that can be used to drop (delete) all tables in an SQL Server database:

 EXEC sp_MSforeachtable @command1 = "DROP TABLE ?" 

Do you have any really handy SQLs? Post them in the comments.

Author

Stewart Schatz

Career: Principal CNC Consultant for Syntax Systems Limited specializing Oracle JD Edwards EnterpriseOne and the technology that supports it. Side Hustle: Owner/Operator of E1Tips.com Location: Lancaster, PA USA  What I like to do: Invest in Family, Explore Technology, Lead Teams, Share Knowledge/Experience, Hunt, Hike, etc.
Happy
Happy
0
Sad
Sad
0
Excited
Excited
0
Sleepy
Sleepy
0
Angry
Angry
0
Surprise
Surprise
0

Average Rating

5 Star
0%
4 Star
0%
3 Star
0%
2 Star
0%
1 Star
0%

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Previous post Great iSeries SQL Reference When Working With Dates & Times
Next post How To Send Email Attachments Using Native Oracle JDEdwards EnterpriseOne