zoukankan      html  css  js  c++  java
  • sql2005删除数据库中所有表,视图,存储过程

    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

  • 相关阅读:
    UVa 727
    UVa 11495
    UVa 299
    UVa 10194
    UVa 146
    10025
    Tug of War POJ 2576 DP(类似背包)
    Problem A: Freckles UVA 10034 裸生成树
    UVA 562
    CF DIV 2 206 C. Vasya and Robot
  • 原文地址:https://www.cnblogs.com/zwei1121/p/1664282.html
Copyright © 2011-2022 走看看