views:

79

answers:

1

A SQL 2000 db was detached, SQL 2000 was uninstalled. Then SQL 2005 installed in the same machine. Then the database was attached to the newly installed SQL 2005 server. It seemed to work at first but after the users started to poke around, error related to null started to pop. Null values from datetime columns that DID NOT have nulls, and things like that. The db has a compatibility level to 2000 (8.0). What could be happening.

+1  A: 

Have you you run DBCC UPDATEUSAGE?

In earlier versions of SQL Server, the values for the table and index row counts and page counts can become incorrect. Therefore, databases that were created on versions prior to SQL Server 2005 may contain incorrect counts. After you upgrade a database to SQL Server 2005, we recommend that you run DBCC UPDATEUSAGE to correct any invalid counts. This DBCC statement corrects the rows, used pages, reserved pages, leaf pages and data page counts for each partition in a table or index. For more information, see DBCC UPDATEUSAGE (Transact-SQL).

Have you rebuilt all indexes?

exec sp_msforeachtable "dbcc dbreindex('?')"

Note: be careful if this is in production, as it might take a while. Perhaps talk to your DBA.

Mitch Wheat
This solved the problem, there were multiple mismatches with reported number of pages and rows.Thanks
nmarmol
It seems that I spoke too soon. One of the tables is still throwing errors.
nmarmol
But the rest is working fine.
nmarmol
Run a low level disk check
Mitch Wheat
...after backing up of course...
Mitch Wheat