If I update a view, will my original tables get updated

前端 未结 3 952
無奈伤痛
無奈伤痛 2020-12-30 19:20

Hypothetically I have two tables Employee and Locations. Additionaly I have a view viewEmpLocation which is made by joining Employee and Locations.

If I update the v

3条回答
  •  醉话见心
    2020-12-30 20:02

    see Using Views in Microsoft SQL Server

    When modifying data through a view (that is, using INSERT or UPDATE statements) certain limitations exist depending upon the type of view. Views that access multiple tables can only modify one of the tables in the view. Views that use functions, specify DISTINCT, or utilize the GROUP BY clause may not be updated. Additionally, inserting data is prohibited for the following types of views:

    * views having columns with derived (i.e., computed) data in the SELECT-list  
    * views that do not contain all columns defined as NOT NULL from the tables from which they were defined
    

    It is also possible to insert or update data through a view such that the data is no longer accessible via that view, unless the WITH CHECK OPTION has been specified.

提交回复
热议问题