Top 10 tables in a SQL Server database

CREATE TABLE #TableSizes
(
     TableName VARCHAR(255),
     TableRows INT,
     ReservedSpaceKB VARCHAR(20),
     DataSpaceKB VARCHAR(20),
     IndexSizeKB VARCHAR(20),
     UnusedSpaceKB VARCHAR(20)
);

INSERT INTO #TableSizes
EXEC sp_msforeachtable 'sp_spaceused ''?''';

UPDATE #TableSizes SET ReservedSpaceKB = REPLACE(ReservedSpaceKB ,'KB','');
UPDATE #TableSizes SET DataSpaceKB = REPLACE(DataSpaceKB ,'KB','');
UPDATE #TableSizes SET IndexSizeKB = REPLACE(IndexSizeKB ,'KB','');
UPDATE #TableSizes SET UnusedSpaceKB = REPLACE(UnusedSpaceKB ,'KB','');

SELECT TOP 10
     TableName [Table],
     TableRows [# Rows],
     CAST(ReservedSpaceKB AS INT)/1024 AS [Reserved (MB)],
     CAST(DataSpaceKB AS INT)/1024 AS [Data (MB)],
     CAST(IndexSizeKB AS INT)/1024 AS [Index (MB)],
     CAST(UnusedSpaceKB AS INT)/1024 AS [Unused (MB)]
FROM
     #TableSizes
ORDER BY 3 DESC;

DROP TABLE #TableSizes;