简体   繁体   中英

Is it possible to create an indexed view with SQL Server 2008 which selects from another indexed view?

Is it possible to create an indexed view with SQL Server 2008 which selects from another indexed view?

create view V1 as (select 1 as abc)
create view V2 as (select abc from V1 group by abc)

Here are the requirements for indexed views (they are plentiful):

  • The view must reference only base tables in the same database, not other views.

I think the answer is "no, it is not possible".

From Microsoft TechNet Site, in an article about performance:

Q . I have a view defined on top of another view. SQL Server won't let me index the top-level view. What can I do?

A . Consider expanding the definition of the nested view by hand into the top-level view, and then indexing it, indexing the innermost view, or not indexing the view.

Good Luck.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM