DECLARE c2 cursor for
select 'drop table ['+name +']; '
from sysobjects
where xtype = 'u' and name like'TAB%'
open c2
declare @c2 varchar(8000)
fetch next from c2 into @c2
while(@@fetch_status=0)
begin
exec(@c2)
fetch next from c2 into @c2
end
close c2
select 'drop table ['+name +']; '
from sysobjects
where xtype = 'u' and name like'TAB%'
open c2
declare @c2 varchar(8000)
fetch next from c2 into @c2
while(@@fetch_status=0)
begin
exec(@c2)
fetch next from c2 into @c2
end
close c2
deallocate c2
粗体部分为删选条件 u为数据表 name 为表名称 具体可查看sysobjects表