views:

248

answers:

1

I have an index -- let's call it IX_MY_INDEX -- in a SQL Server table (both compatibility modes 80 and 90) that I would like to determine the size of. How do I do this?

Update: Allain Lalonde's second solution below only works when the compatibility mode is set to 90; however, the particular database I am working on is in compatibility mode 80. Does anyone have a solution for compatibility mode 80?

+6  A: 

You can determine the size of all indexes on a table (and other things) like so:

EXEC sp_spaceused TableName;

For a full breakdown you may:

SELECT * 
FROM sys.dm_db_index_physical_stats(db_id(), object_id('TableName'), null, null, 'DETAILED');
Allain Lalonde
Many thanks. The second option you have given returns this error:Msg 102, Level 15, State 1, Line 3Incorrect syntax near '('.
Charles Roper
It seems that the query is failing because I'm in 80 compatibility mode. Do you have a solution for 90 compatibility?
Charles Roper