• Interesting question!

    I would have expected the ALTER VIEW to fail because of the presence of an index - if you had included that as an answer option, I would have picked the wrong answer.

    Now I picked the right answer, but for the wrong reason (I thought the last CREATE INDEX would fail because of the duplicate index name).

    Since I was unaware of the effect of ALTER VIEW on an indexed view, I decided to check if it's documented. Turns out it is, in the ALTER VIEW section of Books Online:

    "ALTER VIEW can be applied to indexed views; however, ALTER VIEW unconditionally drops all indexes on the view."


    Hugo Kornelis, SQL Server/Data Platform MVP (2006-2016)
    Visit my SQL Server blog: https://sqlserverfast.com/blog/
    SQL Server Execution Plan Reference: https://sqlserverfast.com/epr/