With this snippet, you can display information about size of all tables of the DB.
1USE myDatabase;2GO
34SELECT5 t.Name AS TableName,6 s.Name AS SchemaName,7 p.RowsAS RowCounts,8SUM(a.total_pages)*8AS TotalSpaceKB,9SUM(a.used_pages)*8AS UsedSpaceKB,10(SUM(a.total_pages)-SUM(a.used_pages))*8AS UnusedSpaceKB
11FROM12 sys.tables t
13INNERJOIN sys.indexes i ON t.object_id = i.object_id
14INNERJOIN sys.partitions p ON i.object_id = p.object_id AND i.index_id = p.index_id
15INNERJOIN sys.allocation_units a ON p.partition_id = a.container_id
16LEFTOUTERJOIN sys.schemas s ON t.schema_id = s.schema_id
17WHERE18 t.Name NOTLIKE'dt%'19AND t.is_ms_shipped =020AND i.object_id >25521GROUPBY22 t.Name, s.Name, p.Rows23ORDERBY24 t.Name;2526GO