Error 2513

Severity Level 16

Message Text

Table Corrupt: Object id %Id (object name = %.*s) does not match between %.*s and %.*s

Explanation

This error occurs when the DBCC CHECKCATALOG statement deletes a database object in one system table and this is not expected in another. Most often, this occurs when one or more rows in the syscolumns, syscomments, sysindexes, sysprocedures, or sysdepends tables have no corresponding rows in sysobjects. This error can also occur if an operation affecting the system table, such as deletion of a user table, was interrupted.

Action

Although this error seldom interferes with database use, it is a good idea to restore the system table.

Follow these steps to restore the consistency of the system tables:

  1. Display the offending rows by executing a query in the problem database against the two tables mentioned in the message. For example, if the message reports one or more mismatches between syscolumns and sysobjects:
    select * from syscolumns where syscolumns.id not in
    (select sysobjects.id from sysobjects)
  2. Enable updates to system tables:
    sp_configure 'allow updates',1
    go
    reconfigure with override
    go
  3. Make sure that the rows displayed in step 1 correspond to reported 2513 errors, and then delete them from the first table mentioned in the message text:
    BEGIN TRAN
    DELETE FROM syscolumns WHERE syscolumns.id NOT IN
    (SELECT sysobjects.id FROM sysobjects)
    go
  4. If the number of rows affected by the delete does not match the number found in step 1, roll back the transaction. If the numbers match, commit it:
    COMMIT TRAN
    go
  5. Re-run DBCC CHECKCATALOG to confirm that the mismatches are fixed, then disallow updates to the system tables:
    sp_configure 'allow updates',0
    go
    reconfigure with override
    go
    checkpoint
    go