How To Delete All Tables With Prefix "bkp" From A Given Database?
I have a SQL server 2005. In that server I have 3 databases -> a,b,c. If I want to delete tables Tables only from database 'c'. The table's name should start with 'bkp' Table
Solution 1:
Try this:
USE C
GO
SELECT'DROP TABLE '+ name
FROM sys.tables
WHERE create_date >='20101211'-- substitute your date you're interested inAND name like'bkp%'This will create as output a list of DROP TABLE:.... statement - copy those and paste them into a new SSMS window and execute those - and you're done!
Post a Comment for "How To Delete All Tables With Prefix "bkp" From A Given Database?"