删除数据库中所有表,存储过程
2019-06-04 14:43 转身寻找静谧 阅读(390) 评论(0) 编辑 收藏 举报use 数据库名称
declare @tname varchar(8000)
set @tname=''
select @tname=@tname + Name + ',' from sysobjects where xtype='U'
select @tname='drop table ' + left(@tname,len(@tname)-1)
print @tname
exec(@tname)
go
use 数据库名称
declare @tname varchar(8000)
set @tname=''
select @tname=@tname + Name + ',' from sysobjects where xtype='P'
select @tname='drop Procedure ' + left(@tname,len(@tname)-1)
print @tname
exec(@tname)
go