您现在的位置是: 首页 > 后端开发 SqlServer 刷新所有视图
SqlServer 刷新所有视图
2020-05-20 【后端开发】 2300人已围观 4195次浏览
简介SqlServer 刷新所有视图
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE procedure [dbo].[RefreshAllView]
as
begin
declare @ViewName varchar(250)
declare #views cursor for select name from sysobjects
where objectproperty(id,N’IsView’)=1
and objectproperty(id,N’IsSchemaBound’)=0 and uid=1 order by name
open #views
fetch next from #views into @viewname
while @@fetch_status=0
begin
begin try
exec sp_refreshview @viewname –更新视图
print ’更新成功: ’+ @viewname
end try
begin catch
print ’更新出错: ’+ @viewname + ’ ’ + ERROR_MESSAGE()
end catch
fetch next from #views into @viewname
end
close #views
deallocate #views
end
GO
很赞哦! (0)
相关文章
- 记一次Java MessageFormat.format踩坑
- 记一次 Mybatis-Plus 自动填充无效问题解决
- Error in execution; nested exception is io.lettuce.core.RedisCommandExecutionException: ERR DISABLE You can't write or read against a disable instance
- SqlServer字符串处理
- springboot引入mybatis-plus后出现ClassNotFoundException: org.mybatis.logging.LoggerFactory
- 获取阿里云CDN真实IP
- RocketMQ 出现 sendDefaultImpl call timeout 问题
- SpringBoot 启动测试时出现提示 Test class should have exactly one public zero-argument constructor
- SqlServer 优化技巧
- 类 BASE64Decoder 程序包 sun.misc 找不到符号
点击排行
- Error in execution; nested exception is io.lettuce.core.RedisCommandExecutionException: ERR DISABLE You can't write or read against a disable instance
- Debian apt 使用国内镜像
- RocketMQ 出现 sendDefaultImpl call timeout 问题
- 类 BASE64Decoder 程序包 sun.misc 找不到符号
- SpringBoot @NotBlank 不生效问题
- 记一次 Mybatis-Plus 自动填充无效问题解决
- SpringBoot 2.x 文件上传出现 The field file exceeds its maximum permitted size of 1048576 bytes
- nuxt 项目完整部署方案
站长推荐
猜你喜欢
- Nestedset 出现 Node must exists. 错误解决方案
- mybatis中大于等于小于等于的写法
- Redis 提示 MISCONF Redis is configured to save RDB snapshots, but it is currently not able to persist on disk 解决方案
- Linux no space left on device 出现设备上没有空间问题
- 使用 OpenSSL 将 pfx 格式证书转为 pem 格式
- Linux 服务器之间传输大文件(压缩文件、查看MD5、后台传输)
- docker mysql 导入 SQL 脚本
- npm 出现 Unexpected token < in JSON at position 21330
- layUI点击按钮页面刷新问题解决方案
- SpringBoot 定时任务 多线程