Sql Server批量删除指定表

--批量删除以test的表开头的表
declare @name varchar(50)
while(exists(select * from sysobjects where name like test%' ))
begin
select @name=name from sysobjects where name like test%' 
exec ('drop table '+@name)
end

 

posted @ 2016-03-04 13:45  一夜秋2014  Views(425)  Comments(0Edit  收藏  举报