How to delete all tables with prefix “bkp” from a given database?

你离开我真会死。 提交于 2019-12-02 01:24:57

Try this:

USE C
GO

SELECT
'DROP TABLE ' + name
FROM sys.tables
WHERE create_date >= '20101211'   -- substitute your date you're interested in
AND 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!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!