sql批量删除表

declare @name varchar(20)
set @name='spb_'
declare cou cursor for
select name from sysobjects where name like N'%'+@name+'%' and type='u'
open cou
FETCH NEXT FROM cou into @name
while @@FETCH_STATUS = 0
begin
exec ('drop table '+@name)
print @name;
FETCH NEXT FROM cou into @name
end
close cou DEALLOCATE cou
posted @ 2010-12-06 14:58  Devin Mao  阅读(288)  评论(0编辑  收藏  举报