一次 全部删除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

原文地址:https://www.cnblogs.com/lidingwen/p/1879677.html