34,590
社区成员
发帖
与我相关
我的任务
分享
declare @vw_name varchar(128)
declare @sql varchar(512)
declare cur_views cursor for
select name from dbo.sysobjects where type=N'V' and category=0
open cur_views
fetch next from cur_views into @vw_name
while @@fetch_status!=-1 begin
set @sql = 'drop view '''+@vw_name+''''
exec @sql
fetch next from cur_views into @vw_name
end
close cur_views
deallocate cur_views