Thursday, July 7, 2011

How To Drop Multiple Tables With Common Prefix

Script to drop all table names in a databases starts with xyz prefix. 

select 'DROP TABLE ' + NAME from sys.objects where type_desc = 'USER_TABLE' AND NAME LIKE 'xyz%'

Replace the name 'xyz' with your table name prefix, for example if you would like to delete all the tables from the database which is starts with xyz.
script to drop all tables whose name begins with a given. Drop all the tables in sql server 2012. drop all the tables in sql server 2008. drop all the tables in sql server 2005. drop all tables in a database with a given name. DROP TABLE (Transact-SQL). How to drop multiple tables with common prefix. Drop All Tables in Database Quickly. Drop tables with unknown names and unknown quantity. Drop table if exist with similar name in two schema. sql server drop all tables.


Post a Comment