删除所有存储过程
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)
exec(@tname)

删除所有表
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)
exec(@tname)

删除所有视图
use 数据库
declare @tname varchar(8000)
set @tname=''
select @tname=@tname + Name + ',' from sysobjects where xtype='V'
select @tname='drop View ' + left(@tname,len(@tname)-1)
exec(@tname)

Last modification:January 8th, 2014 at 10:31 am
如果觉得我的文章对你有用,请随意赞赏