Tag Archives: Integrity of data table index

DBCC CHECKTABLE in Microsoft SQL Server

Checks the integrity of the data, index for a table in SQL Server

Checks the integrity of the data, index, text, ntext, and image pages for the specified table or indexed view.

Syntax

DBCC CHECKTABLE      ( 'table_name' | 'view_name'
[ , NOINDEX
| index_id
| { REPAIR_ALLOW_DATA_LOSS
| REPAIR_FAST
| REPAIR_REBUILD }
])

Example
A. Check a specific table
This example checks the data page integrity of the authors table.

DBCC CHECKTABLE ('authors')
GO

B. Check the table without checking non clustered indexes
This example checks the data page integrity of the authors table without checking non clustered indexes.

DBCC CHECKTABLE ('authors') WITH PHYSICAL_ONLY

C. Check a specific index
This example checks a specific index, obtained by accessing sysindexes.

USE pubs
DECLARE @indid int
SELECT @indid = indid
FROM sysindexes
WHERE id = OBJECT_ID('authors') AND name = 'aunmind'
DBCC CHECKTABLE ('authors', @indid)