Is it possible to create an indexed view with SQL Server 2008 which selects from another indexed view?
-
06-07-2019 - |
Question
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)
Solution
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.
OTHER TIPS
Here are the requirements for indexed views (they are plentiful):
- The view must reference only base tables in the same database, not other views.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow