Sql-Server

如何在不重新創建視圖的情況下關閉 SCHEMABINDING?

  • January 15, 2018

如何在SCHEMABINDING不重新創建視圖的情況下關閉視圖?

是的。最好使用 SCHEMABINDING(我們總是這樣做),有時您必須刪除它才能更改依賴對象。只需改變視圖

ALTER VIEW myView
--Remove this WITH SCHEMABINDING
AS
SELECT ...
GO

ALTER VIEW 不允許您完成這項工作嗎?當您創建視圖時,您將執行以下操作:

CREATE VIEW
WITH SCHEMABINDING
AS
SELECT stmt
GO

所以,丟掉 WITH 子句:

ALTER VIEW viewname
AS
SELECT stmt
GO

請參閱MSDN 上的 ALTER VIEW

引用自:https://dba.stackexchange.com/questions/1942