select name from sysobjects where xtype='u' 使用一个游标,循环删除..
declare @a varchar(50) declare a cursor for select name from sysobjects where xtype='U' open a fetch next from a into @a while @@fetch_status=0 begin exec('drop table '+@a+'') fetch next from a into @a end close a deallocate a
使用一个游标,循环删除..
declare a cursor for
select name from sysobjects where xtype='U'
open a
fetch next from a into @a
while @@fetch_status=0
begin
exec('drop table '+@a+'')
fetch next from a into @a
end
close a
deallocate a