欢迎来到我的的博客园,祝大家学有所成,早点实现自己的人生理想。

批量删除SQL数据库中的所有表【笔记】

use OTRJiraDB
GO
declare @sql varchar(8000)
while (select count(*) from sysobjects where type='U')>0
begin
SELECT @sql='drop table ' + name
FROM sysobjects
WHERE (type = 'U')
ORDER BY 'drop table ' + name
exec(@sql) 
end

 

posted @ 2016-12-06 14:29  宋兴柱  阅读(682)  评论(0编辑  收藏  举报