I came before this very weird error:
Msg 7999, Level 16, State 9, Line 12 Could not find any index named 'IX_MyIndex' for table 'dbo.MyTable'.
When running the script to create it!!
CREATE NONCLUSTERED INDEX [IX_MyIndex] ON [dbo].[MyTable] (
[Field1]
,[Field2]
) INCLUDE (
Fields3
,Fields4
,Fields5
)
WITH (
MAXDOP = 4
,DATA_COMPRESSION = PAGE
,DROP_EXISTING = ON
)
What am I missing?
Yes it tries to search index with name - IX_MyIndex which is not available. But after creating index of name IX_MyIndex you can run the same query. Far better to mark Suraj's response as the answer than to post your own. Because that is how SO works.
Previously, modifying the table while an index is being created or dropped typically resulted in a deadlock that cancelled the INSERT, UPDATE, or DELETE statement on the table. "If your using a version greater than 5.1 indices are created while the database is online. So not to worry you won't interrupt production system use."
Previously, modifying the table while an index is being created or dropped typically resulted in a deadlock that cancelled the INSERT, UPDATE, or DELETE statement on the table.
The CREATE INDEX or DROP INDEX statement only finishes after all transactions that are accessing the table are completed, so that the initial state of the index reflects the most recent contents of the table.
Remove the last line and execute it.
CREATE NONCLUSTERED INDEX [IX_MyIndex]
ON [dbo].[MyTable]
([Field1],[Field2])
INCLUDE (Fields3, Fields4, Fields5)
It is trying to search index with name - IX_MyIndex
which is not available. But after creating an index of name IX_MyIndex
you can run the same query.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With