久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

如何在 SQL Server 2008 中重建視圖

How to rebuild view in SQL Server 2008(如何在 SQL Server 2008 中重建視圖)
本文介紹了如何在 SQL Server 2008 中重建視圖的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

我的數(shù)據(jù)庫中有一個(gè)視圖,有人用一個(gè)表中的 * 定義了這個(gè)視圖.我剛剛在該表中添加了一個(gè)新列,并且我希望視圖反映新列.除了重新執(zhí)行視圖創(chuàng)建腳本之外,還有其他方法可以重建視圖嗎?我正在尋找類似于 sp_recompile 如何重新編譯存儲(chǔ)過程(或者更準(zhǔn)確地將其標(biāo)記為下次調(diào)用時(shí)編譯)的方法.

更新:從長遠(yuǎn)來看,我嘗試在視圖上調(diào)用 sp_recompile,雖然調(diào)用有效,但它沒有重建視圖.

更新 2: 我希望能夠從腳本中執(zhí)行此操作.因此,將列添加到表的腳本也可以更新視圖.所以就像我說的,類似于 sp_recompile.

解決方案

我相信您正在尋找的是

sp_refreshview [ @viewname = ] 'viewname'

<塊引用>

更新指定的元數(shù)據(jù)非模式綁定視圖.執(zhí)著的視圖的元數(shù)據(jù)可以變成由于更改而過時(shí)視圖所基于的底層對(duì)象取決于.

見微軟文檔

There is a view in my DB that someone defined with a * from one table. I just added a new column to that table and I want the view to reflect the new column. Besides re-executing the view creation script, is there another way to rebuild the view? I am looking for something similar to how sp_recompile will recompile a stored procedure (or more accurately flag it to be compiled next time it is called).

Update: On a long shot I tried calling sp_recompile on the view and while the call worked, it didn't rebuild the view.

Update 2: I would like to be able to do this from a script. So the script that adds the columns to the table could also update the view. So like I said, something similar to sp_recompile.

解決方案

I believe what you're looking for is

sp_refreshview [ @viewname = ] 'viewname'

Updates the metadata for the specified non-schema-bound view. Persistent metadata for a view can become outdated because of changes to the underlying objects upon which the view depends.

See Microsoft Docs

這篇關(guān)于如何在 SQL Server 2008 中重建視圖的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

SQL trigger on Truncate(截?cái)鄷r(shí)的 SQL 觸發(fā)器)
sql search query with multiple optional search parameters(具有多個(gè)可選搜索參數(shù)的 sql 搜索查詢)
SQL Efficiency: WHERE IN Subquery vs. JOIN then GROUP(SQL 效率:WHERE IN 子查詢 vs. JOIN 然后 GROUP)
Retrieving XML element name using t-SQL(使用 t-SQL 檢索 XML 元素名稱)
Insert double quotes into SQL output(在 SQL 輸出中插入雙引號(hào))
Delete rows from CTE in SQL SERVER(從 SQL SERVER 中的 CTE 中刪除行)
主站蜘蛛池模板: www四虎影院 | 日韩免费看片 | 午夜激情小视频 | 亚洲国产成人91精品 | 亚洲国产中文字幕 | 伊人久久在线 | 午夜影视剧场 | 国产h视频在线观看 | 亚洲成人动漫在线观看 | 亚洲精品一二三区 | 久久综合99 | 久久久中文字幕 | 国产麻豆精品视频 | 国产精品一区在线播放 | 亚洲精品一区二区三区精华液 | 欧美精品一区二区在线观看 | 91在线视频播放 | 久久综合亚洲 | 国精产品99永久一区一区 | 亚洲成人av在线播放 | 日韩中文字幕视频 | 在线看片a | 国产成人免费观看 | 免费黄色片视频 | 久久精品久久久久 | 99视频网| 亚洲欧美在线视频 | 欧美在线观看视频 | 日韩成人精品 | 精品国产乱码久久久久久蜜臀网站 | 成人免费毛片果冻 | 亚洲黄色影院 | 久久精品一区二区三区四区 | 日韩一区二区中文字幕 | 亚洲丝袜av| 成年人视频网站 | 日本综合久久 | 国产综合久久久 | 福利一区福利二区 | www国产精品 | 在线黄网|