首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

更新sqlserver视图模式

2013-12-06 
更新sqlserver视图方式declare @vname sysnamedeclare refresh_cursor cursor forselect name from sysobj

更新sqlserver视图方式

declare @vname sysnamedeclare refresh_cursor cursor for  select name from sysobjects where xtype = 'v' order by crdatefor read only  open refresh_cursorfetch next from refresh_cursor into @vname while @@fetch_status = 0 begin  --刷新指定视图的元数据。由于视图所依靠的基础对象发生更改,视图的持久元数据会过期。  exec sp_refreshview @vname  print '视图' + @vname + '已更新'  fetch next from refresh_cursor      into @vname endclose refresh_cursordeallocate refresh_cursor

热点排行