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)
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.