Overview
Following on from my previous post, here's a quick way to find out which data tables are using the most disk space...
References
Solution
SELECT o.name AS table_name, SUM(au.data_pages) as pages, ((SUM(au.data_pages) * 8192) / (1024 * 1024)) AS MB FROM sys.allocation_units AS au JOIN sys.partitions AS p ON au.container_id = p.partition_id JOIN sys.tables AS o ON p.object_id = o.object_id JOIN sys.indexes AS i ON p.index_id = i.index_id AND i.object_id = p.object_id GROUP BY o.name ORDER BY pages desc, o.name GO
Versions
Metadata