开发者

Updatable views - SQL Server 2008

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

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

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 table开发者_JAVA技巧s (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?


You can use an INSTEAD OF trigger on a view to keep your application only dealing with the view instead of the collection of base tables the view references.

Here is an example : Designing INSTEAD OF Triggers


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜