Error 1520

Severity Level 18

Message Text

Sort failed because dpages in the Sysindexes row for table '%.*s' in database '%.*s' had an incorrect value. Please run DBCC CHECKTABLE on this table to correct the value, then re-run your command.

Explanation

This error occurs when the create index statement fails while attempting to sort table data. The create index statement allocates work area based on an estimate in the system catalogs for the number of data pages used by the table. If the value is too small, the work area will not be large enough to complete the sort operation.

Maintaining an up-to-date record of the number of pages in use by a table would require significant overhead and could significantly slow performance.

Action

To correct the page count, use one of the following statements:

dbcc tablealloc(tablename)

dbcc newalloc(databasename)

dbcc checktable(tablename)

After running DBCC, you should be able to create the index.