Dropping MS SQL Tables that have a Prefix using T-SQL

How many times have you wanted to drop a selection of Microsoft SQL Server tables that have begin with some common characters? I have many times especially when I’m testing certain web applications, such as Orchard CMS, and using different database prefix values to switch between instances. Thanks to Curt Hagenlocher over at a StackOverflow post, I now can.

This can easily be updated to include views, stored procedures, and functions.



Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>