mssql批量删除数据库里所有的表

go
declare @tbname varchar(250)
declare #tb cursor for select name from sysobjects where objectproperty(id,'IsUserTable')=1
open #tb
fetch next from #tb into @tbname
while @@fetch_status=0
begin
exec('drop table ['+@tbname+']')
fetch next from #tb into @tbname
end
close #tb
deallocate #tb

  

原文地址:https://www.cnblogs.com/sntetwt/p/3404466.html