zwei1121

博客园 首页 新随笔 联系 订阅 管理

declare @table varchar(600)

while (select count(*) from sysobjects where type='u')>=1
 begin
  set @table=(select top 1 name from sysobjects where type='u')
  set @table='drop table '+@table
  exec(@table)
 end
select  name,type from sysobjects where type='u'

 

declare @table varchar(600)
while (select count(*) from sysobjects where type='v')>=1
 begin
  set @table=(select top 1 name from sysobjects where type='v')
  set @table='drop view '+@table
  exec(@table)
 end
select  name,type from sysobjects where type='v'


DECLARE @STRING VARCHAR(8000)
WHILE EXISTS(SELECT NAME FROM SYSOBJECTS WHERE TYPE='P' AND STATUS>=0 and uid=1)
BEGIN
SELECT TOP 1 @STRING='DROP PROCEDURE '+NAME FROM   SYSOBJECTS    WHERE   TYPE = 'P' AND STATUS>=0 and uid=1
--SELECT @STRING
EXEC(@STRING)
END

posted on 2010-02-05 11:46  zwei  阅读(450)  评论(0编辑  收藏  举报