Search code examples
sqlsql-serverdbcc

DBCC CHECKDB to check errors in SQL Server database


Is it possible to run: DBCC CHECKDB on a specific table in SQL Server 2005 database?

I have the following syntax:

DBCC CHECKDB 
[
    [ ( database_name | database_id | 0
        [ , NOINDEX 
        | , { REPAIR_ALLOW_DATA_LOSS | REPAIR_FAST | REPAIR_REBUILD } ]
    ) ]
    [ WITH 
        {
            [ ALL_ERRORMSGS ]
            [ , EXTENDED_LOGICAL_CHECKS ] 
            [ , NO_INFOMSGS ]
            [ , TABLOCK ]
            [ , ESTIMATEONLY ]
            [ , { PHYSICAL_ONLY | DATA_PURITY } ]
        }
    ]
]

But keep getting incorrect syntax. I just want to run it to see what errors it throws up? Can you help me with writing the syntax? I want to remove all repair options.


Solution

  • DBCC CHECKDB as it names apply is for checking databases.

    There is a DBCC CHECKTABLE command for checking specific tables. Usage is:

    DBCC CHECKTABLE ('YourTable');