declare @tname varchar(8000),@pname VARCHAR(8000),@triname VARCHAR(8000),@ispEnd INT,@istbEnd INT,@timeC INT 
SET @tname=''
SET @pname=''
SET @triname=''
SET  @ispEnd=0 --存储过程是否删除完了
SET  @istbEnd=0 --表是否删除完了
SET @timeC=10
---删除表
WHILE(@istbEnd=0 AND @timeC>0)
BEGIN
SELECT TOP(50) @tname=@tname + Name + ',' from sysobjects where xtype='U'
IF(@tname!='')
 BEGIN
   select @tname='drop table ' + left(@tname,len(@tname)-1)
   SET @timeC=@timeC-1
   EXEC(@tname)
   SET @tname=''
 END
ELSE
  BEGIN
    SET @istbEnd=1
  END
END
SET @timeC=10
---删除存储过程
WHILE(@ispEnd=0 AND @timeC>0 )
BEGIN
SELECT TOP(50) @pname=@pname+ NAME +',' FROM sysobjects WHERE xtype='P'
IF(@pname!='')
 BEGIN
   SELECT @pname='drop proc '+LEFT(@pname,LEN(@pname)-1) 
   SET @timeC=@timeC-1
   EXEC(@pname)
   SET @pname=''
 END
ELSE
  BEGIN
    SET @ispEnd=1
  END
END
