【问题标题】:How can i refresh all Views in Database in SQL server如何刷新 SQL Server 数据库中的所有视图
【发布时间】:2022-12-02 20:53:40
【问题描述】:

I want to refresh all views in Database because i renamed some columns and add some more columns in tables so i need to update all views by refreshing them

i created all views as select * from tableName only

  • I assume by \"refresh\" you mean \"change the views so they now show the renamed/new columns\"? No way to do that without an external tool or some sophisticated implementation. After all, how would the view know which of the new columns it should include?
  • You need to get a list of all views and call sp_refreshview for each one. But you should stop using * in views.
  • Why did you bother creating views at all if they all all \"select * from tableName only\"? That defeats the purpose of views; you might as well select directly from the tables.

标签: sql sql-server


【解决方案1】:
【解决方案2】:
猜你喜欢
  • 1970-01-01
  • 2011-02-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-01-30
  • 2020-03-29
相关资源
最近更新 更多