可更新视图 - SQL Server 2008 [英] Updatable views - SQL Server 2008

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

问题描述

关于可更新数据库视图的问题:我正在阅读有关该主题的一些 MSDN 文档,但遇到以下限制:

A question about updatable db views: I'm reading through some MSDN documentation on the subject, and I come across the following restriction:

任何修改,包括 UPDATE、INSERT 和 DELETE 语句,都必须只引用一个基表中的列.

Any modifications, including UPDATE, INSERT, and DELETE statements, must reference columns from only one base table.

我只是想确定我了解限制.我想在我的几个媒体评论项目中使用视图.关系数据分布在整个表中,但视图似乎是能够将我需要的数据从多个表(其中一些通过外键链接)合并到一个集中位置的最佳方式.由于列将来自各种表,这是否意味着我不能运行一个完整的 INSERT 或 UPDATE 来保留所有列中的更改?

I just want to be sure I understand the restriction. I'd like to use views in a couple of my media review projects. The relational data is spread throughout tables, but a view seems to be the best way to be able to consolidate the data I need from multiple tables (some of which are linked via foreign keys) into a centralized location. Since the columns would come from a variety of tables, does this mean I can't run one blanket INSERT or UPDATE to persist changes in all the columns?

推荐答案

是的,就是这个意思.我认为通过视图更新没有任何好处,因为无论如何您都必须知道所涉及的基表是什么.

Yes that's what it means. I see no advantage to updating through a view since you have to know what the base tables involved are anyway.

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

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