FIX: SELECT * FROM SYSINDEXES on a database that is upgraded to SQL Server 2000 may cause an access violation
Symptoms
Executing a SELECT * FROM SYSINDEXES query against a database that has been upgraded from Microsoft SQL Server 7.0 may cause an Access Violation. If an Access Violation occurs, an error message similar to the following displays in the query window:
ODBC: Msg 0, Level 19, State 1
SqlDumpExceptionHandler: Process 51 generated fatal exception c0000005 EXCEPTION_ACCESS_VIOLATION. SQL Server is terminating this process.
Server: Msg 1203, Level 20, State 1, Line 1
Process ID 51 attempting to unlock unowned resource KEY: 7:2:1 (790023da5d09).
Resolution
The maximum length defined for the keys column in the sysindexes system table in SQL Server 2000 is 1088, while in SQL Server 7.0, it is only 816. When a database is upgraded from SQL Server 7.0, the maximum length defined for the keys column is not updated. As a result, when an index whose keys column exceeds 816 bytes is created and the index is subsequently fetched, as in a SELECT * FROM SYSINDEXES query, the prefetch buffer is written past the 816 bytes that have been allocated, which causes the Access Violation.
