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.
views:
79answers:
1
+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
2009-06-13 01:20:47
This solved the problem, there were multiple mismatches with reported number of pages and rows.Thanks
nmarmol
2009-06-14 13:42:44
It seems that I spoke too soon. One of the tables is still throwing errors.
nmarmol
2009-06-18 02:25:28
But the rest is working fine.
nmarmol
2009-06-18 02:26:14
Run a low level disk check
Mitch Wheat
2009-06-18 02:46:50
...after backing up of course...
Mitch Wheat
2009-06-18 02:47:25