Returns the table name, index name, and number of rows.
Select object_name (I. object_id) as objectname, I. [name] As indexname, sum (P. Rows) as rowcnt
From SYS. Indexes I
Inner join SYS. partitions P
On I. object_id = P. object_id
And I. index_id = P. index_id
Where I. object_id = object_id ('dbo. Meeting ')
And I. index_id <= 1
Group by I. object_id, I. index_id, I. [name]
Returns the total number of pages, number of pages used, and number of data pages of the table.
Select object_name (I. object_id) as objectname, I. [name] As indexname,
Sum (A. total_pages) as totalpages, sum (A. used_pages) as usedpages, sum (A. data_pages) as datapages,
(Sum (A. total_pages) * 8)/1024 as totalspacemb, (sum (A. used_pages) * 8)/1024 as usedspacemb,
(Sum (A. data_pages) * 8)/1024 as dataspacemb
From SYS. Indexes I
Inner join SYS. partitions P
On I. object_id = P. object_id
And I. index_id = P. index_id
Inner join SYS. allocation_units
On P. partition_id = A. container_id
Where I. object_id = object_id ('dbo. Meeting ')
And I. index_id <= 1
Group by I. object_id, I. index_id, I. [name]
Statistics by PAGE type
Select case when grouping (I. object_id) = 1 then '--- total --- 'else object_name (I. object_id) end as objectname,
Case when grouping (I. [name]) = 1 then '--- total --- 'else I. [name] end as indexname,
Case when grouping (A. type_desc) = 1 then '--- total --- 'else A. type_desc end as pagetype,
Sum (A. total_pages) as totalpages, sum (A. used_pages) as usedpages, sum (A. data_pages) as datapages,
(Sum (. total_pages) * 8)/1024 as totalspacemb, (sum (. used_pages) * 8)/1024 as usedspacemb, (sum (. data_pages) × 8)/1024 as dataspacemb
From SYS. Indexes I
Inner join SYS. partitions P
On I. object_id = P. object_id
And I. index_id = P. index_id
Inner join SYS. allocation_units
On P. partition_id = A. container_id
Where I. object_id = object_id ('dbo. Meeting ')
And I. index_id <= 1
Group by I. object_id, I. [name], A. type_desc with Rollup