一次 全部删除MSSQL数据库用户表,存储过程

 

删除表

EXECUTE sp_msforeachtable 'truncate table ?' 

 

删除proc

declare c_1 cursor for select name from sysobjects where xtype= 'P' --遍历游标,创建动态SQL语句,删除存储过程 

declare @pname nvarchar(100) open c_1 fetch next from c_1 into @pname while @@fetch_status=0 begin  exec ( 'drop PROCEDURE '+@pname)  fetch next from c_1 into @pname end close c_1 deallocate c_1

posted @ 2010-11-17 11:22  大笑江湖  阅读(492)  评论(0编辑  收藏  举报