如果我更新视图,我的原始表会更新吗 [英] If I update a view, will my original tables get updated

查看:136
本文介绍了如果我更新视图,我的原始表会更新吗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有两个表 Employee 和 Locations.另外,我有一个视图 viewEmpLocation,它是通过加入 Employee 和 Locations 制作的.

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 view, will the data in the original table get updated?

推荐答案

请参阅 在 Microsoft SQL Server 中使用视图

通过视图修改数据时(即,使用 INSERT 或 UPDATE声明)存在某些限制取决于视图的类型.观看次数访问多个表只能修改视图中的表之一.使用函数的视图,指定DISTINCT,或使用 GROUP BY条款可能不会更新.此外,插入数据是禁止用于以下类型的意见:

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

也可以插入或通过视图更新数据,使得数据不再通过该视图,除非 WITH CHECK已指定选项.

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.

这篇关于如果我更新视图,我的原始表会更新吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆