So if I did apply the correct answer I could not create the additional indexes due to the error of attempting to create a "duplicate" index?
Not sure if I understand your question (see how hard it is to be unambiguous?), but the QotD was which statement could be used to create an indexed view (after the view had been created using the given CREATE VIEW statement). Only one of those statements would succeed.
The QotD wasn't which statement should be executed first. If someone wanted to create another index after that, then of course they would have to use a name that isn't already being used.
The question as stated is:
Which of the following SQL statements can you execute to create an index on the view?
My line of reasoning, after deciding which was the correct answer was:
1. Asked myself why couldn't other indexes be created, when I knew that additional indexes could be created.
2. Carefully examined the code to create the additional indexes.
3. Noted that the names of the additional indexes that could be created were identical as the name of the correct index.
4. Ruled out creating those indexes based on knowing that I could not have multiple indexes on a view or table with identical names.
5. Did not think it was my right to change the T-SQL code listed as possible answers.
6. Ergo the light lit and there was only one answer - which is the answer you identifed as the correct answer.
Then was agast at those who did not read the proposed answers very, very carefully.
Now all the quibbling aside. The objective of the QOD is to TEACH or TEST ones knowledge of SQL Server. Which your question has done .
So do not be discouraged by the comments on this particular question, for its publication has taught you a thing or two or more. Please think of other QODs and submitt them so all may learn more about SQL Server.
Strictly as aside. I have had 38 QODs published. Of those, with 3 of them, "I shot myself in the foot" as the saying goes. But like a rubber band I snaped back and kept at it. And in double and tripple checking my proposed QODs learned a great deal. Hope you do the same as you submitt additional QODs.
If everything seems to be going well, you have obviously overlooked something.
Please help us, help you -before posting a question please read[/url]
Before posting a performance problem please read[/url]