直接将以下代码复制到SQL中运行即可,记得一定先指定数据库,否则操作失误可无法恢复的。
declare @table varchar(600)
while (select count(*) from sysobjects where type='u')>=1
begin
set @table=(select top 1 name from sysobjects where type='u')
set @table='drop table '+@table
exec(@table)
end
select name,type from sysobjects where type='u'