views:

526

answers:

2

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)
+2  A: 

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.

Jonathan
+2  A: 

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

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