SELECT OBJECT_NAME(i.OBJECT_ID) AS TableName, i.name AS I...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Gardening and Landscaping Meta

Q&A about the site for gardeners and landscapers

SELECT OBJECT_NAME(i.OBJECT_ID) AS TableName, i.name AS IndexName, i.index_id AS IndexID, 8 * SUM(a.used_pages) AS 'Indexsize(KB)', (8 * SUM(a.used_pages)) / 1024 AS 'Indexsize(MB)'
FROM sys.indexes AS i
INNER JOIN sys.partitions AS p ON p.OBJECT_ID = i.OBJECT_ID AND p.index_id = i.index_id
INNER JOIN sys.allocation_units AS a ON a.container_id = p.partition_id
--WHERE OBJECT_NAME(i.object_id) = @TableName
GROUP BY i.OBJECT_ID, i.index_id, i.name
ORDER BY 5 --OBJECT_NAME(i.OBJECT_ID), i.index_id

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results