--删除视图:
use 表空间
declare mycur cursor local for select [name] from dbo.sysobjects where xtype='V' --声明游标
declare @name varchar(100)
OPEN mycur --打开游标
FETCH NEXT from mycur into @name
WHILE @@FETCH_STATUS = 0
BEGIN
exec('drop VIEW ' + @name)
FETCH NEXT from mycur into @name --逐条读取
END
CLOSE mycur --关闭游标
--删除存储过程:
use 表空间
declare mycur cursor local for select [name] from dbo.sysobjects where xtype='P'
declare @name varchar(100)
OPEN mycur
FETCH NEXT from mycur into @name
WHILE @@FETCH_STATUS = 0
BEGIN
exec('drop PROCEDURE ' + @name)
FETCH NEXT from mycur into @name
END
CLOSE mycur