Error 7902

Severity Level 16

Message Text

Data size mismatch occurred while checking TEXT/IMAGE values. The first page for this value is: %Id. There were %Id bytes found, which is different from the expected data length of %Id bytes.

Explanation

This error occurs when a text or image page does not contain the correct amount of data indicated by the length stored internally in the page. This error is detected when executing DBCC CHECKDB or DBCC CHECKTABLE.

Action

Identify the exact row in the table for the text/image value that is incorrect. Follow these steps:

  1. Run DBCC PAGE for the page listed as the first %Id variable in the error text.
  2. Find the first text page in the page chain by running DBCC PAGE against each page listed as prevpg in the page header until this value is 0. The page that contains prevpg=0 will be the first text page in the chain.
  3. The row can now be uniquely identified by the text pointer value. Execute the following query to determine this row:
    select * from table
    WHERE substring(textptr(text column nam>),1,4) = 0xXXXXXXXX

    0xXXXXXXXX is the hexadecimal representation of the byte- and word-swapped page number determined in step 2. The 0x prefix indicates a hexadecimal value.

    For example, if the page number determined in step 2 is page 1649, this would be 0x00000671. Swapping the positions of the first and second words and bytes within each word would result in 0x71060000. Provide this byte-swapped value in the WHERE clause to determine the exact row.

If the query does not display any text data to capture, you may be able to correct the problem by updating the text value to NULL or by deleting the row.

If this technique does not work, you may have to copy out all non-text columns to another table or restore the database from a known clean backup.

If the problem persists, contact your primary support provider. Have the full output from DBCC CHECKDB or DBCC CHECKTABLE available for review.