Oracle环境快速批量删除VT表脚本
金蝶云社区-huang_yunzhi
huang_yunzhi
0人赞赏了该文章 890次浏览 未经作者许可,禁止转载编辑于2014年09月15日 16:25:38
--定义游标删除VT表,一次删除1000个VT表,重复执行此脚本,直到所有VT表被删除为止
declare c1 cursor for select top 1000 name from sysobjects where name like 'VT%';
open c1;
declare @table_name varchar(100);
DECLARE @SQLString NVARCHAR(500)
fetch c1 into @table_name
while(@@fetch_status=0)
begin
SET @SQLString = N'drop table ' + @table_name
EXEC(@SQLString)
fetch next from c1 into @table_name;
end
close c1;
deallocate c1;