Question

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.

Was it helpful?

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');

OTHER TIPS

Late to the party, but, oh, well... See MS DBCC CHECKTABLE

Syntax:
DBCC CHECKTABLE ( table_name | view_name [ , { NOINDEX | index_id } |, { REPAIR_ALLOW_DATA_LOSS | REPAIR_FAST | REPAIR_REBUILD } ] ) [ WITH { [ ALL_ERRORMSGS ] [ , EXTENDED_LOGICAL_CHECKS ] [ , NO_INFOMSGS ] [ , TABLOCK ] [ , ESTIMATEONLY ] [ , { PHYSICAL_ONLY | DATA_PURITY } ] [ , MAXDOP = number_of_processors ] } ]

Be careful using any of the REPAIR options. Note that the ESTIMATEONLY Argument is just that and ZERO impact, and the PHYSICAL_ONLY option may have a much shorter run-time on large tables.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top