Error 1521
Severity Level 18
Message Text
Sort failed because a table in tempdb used for the processing of the query had a bad data page count. Tempdb should not have been damaged.
Explanation
This error can occur when you are running complex queries that use inefficient query plans. Effective use of indexes can improve query performance.
In most cases, you can resolve the error immediately by inspecting and redefining the indexes on the affected tables.
Action
Follow these steps:
-
Run the UPDATE STATISTICS statement on the table(s) in question. This will update the information about the distribution of key values in the indexes of the specified table(s).
-
Modify the query so that the optimizer produces a different query plan. Here are examples of how this can be done:
-
Use SHOWPLAN to make sure your query is using indexes in the query plan.
-
Change BETWEEN clauses to the corresponding <= and >= expressions.
-
Make sure your indexes have been designed correctly and efficiently.
-
Use optimizer hints to manually control the access plan.
-
Examine the table structure of the table(s) involved to ensure that normalization is not an issue.
If the problem persists, contact your primary support provider for assistance. Have the table and index structure of the table(s) involved, as well as a copy of the problematic query, available for review.