1

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)
usr
  • 168,620
  • 35
  • 240
  • 369

2 Answers2

4

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
  • 37,839
  • 27
  • 91
  • 125
2

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
  • 11,809
  • 5
  • 57
  • 91