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

如何在 SQL Server 2008 中重建視圖

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

問題描述

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

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

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

解決方案

我相信您正在尋找的是

sp_refreshview [ @viewname = ] 'viewname'

<塊引用>

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

見微軟文檔

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 中重建視圖的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

相關(guān)文檔推薦

SQL trigger on Truncate(截?cái)鄷r的 SQL 觸發(fā)器)
sql search query with multiple optional search parameters(具有多個可選搜索參數(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 輸出中插入雙引號)
Delete rows from CTE in SQL SERVER(從 SQL SERVER 中的 CTE 中刪除行)
主站蜘蛛池模板: 亚洲人成人一区二区在线观看 | 日韩免费三级 | 成人在线日韩 | 精品亚洲永久免费精品 | 爱操av | 中文字字幕一区二区三区四区五区 | 97久久精品午夜一区二区 | 青青伊人久久 | 成人免费影院 | 成人a视频片观看免费 | 国产a视频 | 亚洲国产成人精品女人 | 超碰日本 | 久久9精品 | 成人免费观看男女羞羞视频 | 国产精品福利在线观看 | 羞羞视频网页 | 青青草视频网站 | 伊人99| 盗摄精品av一区二区三区 | 亚洲色片网站 | 一区二区三区高清 | 国产精品毛片无码 | 在线视频一区二区三区 | 日本爱爱视频 | 91在线精品一区二区 | 欧美一级电影免费观看 | 美女激情av | 亚洲男女激情 | 免费的黄色片子 | 午夜影院网站 | 日本xx视频免费观看 | 久久精品视频在线观看 | 一级毛片视频免费观看 | 狠狠干天天干 | 色女人天堂 | 久久久精品一区二区三区 | 国产精品日日做人人爱 | 成年人的视频免费观看 | 色天天综合 | 国产日韩91 |