更新视图 [英] Update View

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

问题描述

大家好,

如何在sql server 2005中创建可更新的视图

谢谢.

Hello everyone,

How can I create an updatable view in sql server 2005

Thanks.

推荐答案

以下是摘录自
Following is an extract from MSDN - CREATE VIEW (Transact-SQL)[^]

You can modify the data of an underlying base table through a view, as long as the following conditions are true:
    * Any modifications, including UPDATE, INSERT, and DELETE statements, must reference columns from only one base table.
    * The columns being modified in the view must directly reference the underlying data in the table columns. The columns cannot be derived in any other way, such as through the following:
          o An aggregate function: AVG, COUNT, SUM, MIN, MAX, GROUPING, STDEV, STDEVP, VAR, and VARP.
          o A computation. The column cannot be computed from an expression that uses other columns. Columns that are formed by using the set operators UNION, UNION ALL, CROSSJOIN, EXCEPT, and INTERSECT amount to a computation and are also not updatable.
    * The columns being modified are not affected by GROUP BY, HAVING, or DISTINCT clauses.
    * TOP is not used anywhere in the select_statement of the view together with the WITH CHECK OPTION clause.



有关更多详细信息,请转到链接.向下滚动到备注.您将在可更新的视图"小节中找到.阅读! :thumbsup:



For more details, go to the link. Scroll down to Remarks. You will find a subsection ''Updatable Views''. Read it! :thumbsup:


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

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