其他分享
首页 > 其他分享> > 删除所有的视图,存储过程

删除所有的视图,存储过程

作者:互联网

---------------------删除所有的视图-------------------
use fkbmvcultimate
GO
declare @sql varchar(8000)
while (select count(*) from sysobjects where type='V')>0
begin
SELECT @sql='drop view ' + name
FROM sysobjects
WHERE (type = 'V')
ORDER BY 'drop view ' + name
exec(@sql) 
end


-------------------删除所有的存储过程-------------------
use fkbmvcultimate
GO
declare @sql varchar(8000)
while (select count(*) from sysobjects where type='P')>0
begin
SELECT @sql='drop proc ' + name
FROM sysobjects
WHERE (type = 'P')
ORDER BY 'drop table ' + name
exec(@sql) 
end

标签:存储,name,删除,drop,视图,sql,type,sysobjects
来源: https://www.cnblogs.com/imtudou/p/11251923.html