当前位置: 代码迷 >> SQL >> 更新sqlserver视图模式
  详细解决方案

更新sqlserver视图模式

热度:35   发布时间:2016-05-05 11:53:56.0
更新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
  相关解决方案