码迷,mamicode.com
首页 > 数据库 > 详细

sql server 更新视图的sp

时间:2014-09-26 17:57:08      阅读:250      评论:0      收藏:0      [点我收藏+]

标签:os   ar   for   sp   c   ef   r   sql   res   

create procedure RefreshAllView
as
begin
declare @ViewName varchar(250)
declare #views cursor for select name from sysobjects
where objectproperty(id,N‘IsView‘)=1 and uid=1 order by name
open #views
fetch next from #views into @viewname
while @@fetch_status=0
begin
print ‘正在更新: ‘+ @viewname
exec sp_refreshview @viewname --更新视图
fetch next from #views into @viewname
end
close #views
deallocate #views
end

sql server 更新视图的sp

标签:os   ar   for   sp   c   ef   r   sql   res   

原文地址:http://www.cnblogs.com/rxie/p/3994640.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!