Use the following SQL traversal table to query for problems
DECLARE @table_name VARCHAR( -)DECLARECursor_tableCURSOR for SELECTname fromsys.tablesOPENcursor_tableFETCH Next fromCursor_table into @table_name while(@ @FETCH_STATUS = 0 ) BEGIN DBCCCheckTable (@table_name) PRINT ' ' PRINT '=============================================' PRINT ' ' FETCH Next fromCursor_table into @table_name ENDCLOSEcursor_tabledeallocateCursor_table
If there is a problem, a record similar to the following is entered:
Rece_money'sDBCCresults. Message8952Level -State1The1Row Table error: Table'Rece_money'(ID507148852)。 Index'Pk_rece_money'(ID -) does not match any data rows in the index row. may be redundant or invalid keys on the downside: message8956Level -State1The1Line
... ... ... Table error: Table'Rece_money'(ID507148852)。 Index'Pk_rece_money'(ID -) does not match any data rows in the index row. may be redundant or invalid keys on the downside: message8956Level -State1The1row index Row (1:171607: +) has a value of (rece_money_id= '0000148773' andRece_money_type= 'Return Payment Form' andHEAP RID=(1:34467: the)), point to by (HEAP RID=(1:34467: the) ) identifies the data row. Object'Rece_money'Of3043Page that has57111line. CheckTable in the table'Rece_money'(Object ID507148852) found in0Allocation Errors and +a consistency error. For theDBCCchecktable (Zyhadm.dbo.rece_money) found an error, Repair_rebuild is the lowest repair level. DBCCExecution is complete. IfDBCCThe error message is output, please contact your system administrator.
Fix by statement
DBCC CheckTable (Rece_money,repair_rebuild)