-- If 0 is specified, the current database is used. The statistics are updated before use.
DBCC updateusage (0)
-- Or
DBCC updateusage ('db ')
-- DBCC updateusage correct the rows, used, reserved, and dpages columns of the sysindexes table and the clustered index.
-- Do not maintain the size of non-clustered Indexes
-- DBCC updateusage will correct the Count of rows, used pages, reserved pages, leaf-level pages, and data pages for each partition in the table or index.
Select object_name (ID), dpages used data page, used all index and table data page count,
Total number of pages of all indexes and table data in reserved from sysindexes
Code -- Count the number of table rows in the User table, average row length, and total number of pages
Select name table name, max ([rows]) rows, max (dpages) total data pages,
Max (dpages) * 8000/MAX ([rows]) Average number of bytes of rows from (
Select object_name (ID) Name, rows, dpages
From sysindexes) TT
Where name not like 'sys %'
And rows> 0
And dpages> 50
Group by name
Order by 4 DESC