导航

Sql Server 2005/2008 删除数据库中所有存储过程

Posted on 2010-07-13 21:07  Amos Von  阅读(219)  评论(0编辑  收藏  举报
1 DECLARE @STRING VARCHAR(8000)
2 WHILE EXISTS(SELECT NAME FROM SYSOBJECTS WHERE TYPE='P' AND STATUS>=0 and uid=1)
3 BEGIN
4 SELECT TOP 1 @STRING='DROP PROCEDURE '+NAME FROM SYSOBJECTS WHERE TYPE = 'P' AND STATUS>=0 and uid=1
5 --SELECT @STRING
6 EXEC(@STRING)
7 END