Hi @SQLRocker ,
Welcome back to Microsoft Q&A!
Please refer below query and check whether it is helpful to you.
SELECT
'[' + (OBJECT_SCHEMA_NAME(tables.object_id,db_id())
+ '].[' + tables.NAME + ']') AS TableName,
(sum(allocation_units.total_pages) * 8) / 1024 as TotalSpaceMB
FROM
sys.tables tables
INNER JOIN
sys.indexes indexes ON tables.OBJECT_ID = indexes.object_id
INNER JOIN
sys.partitions partitions ON indexes.object_id = partitions.OBJECT_ID
AND indexes.index_id = partitions.index_id
INNER JOIN
sys.allocation_units allocation_units ON partitions.partition_id = allocation_units.container_id
WHERE
indexes.index_id = 1
GROUP BY
tables.object_id,tables.NAME, indexes.object_id, indexes.index_id, indexes.name
ORDER BY
TotalSpaceMB desc
Best regards,
Melissa
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.