建个游标。取出A库的所有表名。drop talbe 

解决方案 »

  1.   

    while exists(select * from sysobjects where objectproperty(id,'isusertable')=1)
    exec sp_msforeachtable 'drop table ?'
      

  2.   

    老大,为什么要用这个select * from sysobjects where objectproperty(id,'isusertable')=1
    用这个行么?select * from sysobjects where xtype ='u'
    "sp_msforeachtable" 是做什么用的?
      

  3.   

    use tmp
    go
    declare @n int,@name varchar(20)
    select * from sysobjects where type='u'
    set @n=@@rowcount
    while @n>0 
     begin
        select @name=[name] from sysobjects where type='u'
        exec('drop table '+@name+'')
        set @n=@n-1
      end 
    go
      

  4.   

    TO: chinaandys(天煞孤星---风流泪、雨含笑) 
        你的方法报错
        
    服务器: 消息 3701,级别 11,状态 5,行 1
    无法 除去 表 'MSreplication_option',因为它在系统目录中不存在。老大方法有用,就是太~~~慢了
      

  5.   

    我有第一个表是'MSreplication_option'
      

  6.   

    declare @n int,@name varchar(20)
    select * from sysobjects where type='u'
    set @n=@@rowcount
    while @n>0 
     begin
        select @name=[name] from sysobjects where type='u'
        exec('drop table '+@name+'')
        set @n=@n-1
      end 
    go
      

  7.   

    用没有公布的存储过程:EXEC SP_MSFOREACHTABLE @command1=" drop table ?" 
    在这里 ? 代表所有的表