且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用 Alter 在 SQL-Server 2014 的现有视图中添加新列

更新时间:2023-12-01 10:09:46

你必须重新编写整个视图,只需添加或省略你想要更改的内容

you have to write the entire view again and just add or omit what you want to change

例如你现在的观点是:

create view myView as
  select field1
  from table1

现在你想添加一个名为 New_Col 的字段,而不是你写这个:

and now you want to add a field called New_Col than you write this :

alter view myView as
  select field1,
         New_Col
  from table1