更新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