- Docs
- /
21 Feb 2020 23008 views 0 minutes to read Contributors
T-SQLTransact-SQL
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 SELECT DB_NAME() AS 'DatabaseName',OBJECT_NAME(p.OBJECT_ID) AS 'TableName',p.index_id AS 'IndexId',CASEWHEN p.index_id = 0THEN 'HEAP'ELSE i.nameEND AS 'IndexName',p.partition_number AS 'PartitionNumber',prv_left.value AS 'LowerBoundary',prv_right.value AS 'UpperBoundary',ps.name AS PartitionScheme,pf.name AS PartitionFunction,CASEWHEN fg.name IS NULLTHEN ds.nameELSE fg.nameEND AS 'FileGroupName',CAST(p.used_page_count * 0.0078125 AS NUMERIC(18, 2)) AS 'UsedPages_MB',CAST(p.in_row_data_page_count * 0.0078125 AS NUMERIC(18, 2)) AS 'DataPages_MB',CAST(p.reserved_page_count * 0.0078125 AS NUMERIC(18, 2)) AS 'ReservedPages_MB',CASEWHEN p.index_id IN (0,1)THEN p.row_countELSE 0END AS 'RowCount',CASEWHEN p.index_id IN (0,1)THEN 'data'ELSE 'index'END 'Type'FROM sys.dm_db_partition_stats pINNER JOIN sys.indexes i ON i.OBJECT_ID = p.OBJECT_IDAND i.index_id = p.index_idINNER JOIN sys.data_spaces ds ON ds.data_space_id = i.data_space_idLEFT OUTER JOIN sys.partition_schemes ps ON ps.data_space_id = i.data_space_idLEFT OUTER JOIN sys.partition_functions pf ON ps.function_id = pf.function_idLEFT OUTER JOIN sys.destination_data_spaces dds ON dds.partition_scheme_id = ps.data_space_idAND dds.destination_id = p.partition_numberLEFT OUTER JOIN sys.filegroups fg ON fg.data_space_id = dds.data_space_idLEFT OUTER JOIN sys.partition_range_values prv_right ON prv_right.function_id = ps.function_idAND prv_right.boundary_id = p.partition_numberLEFT OUTER JOIN sys.partition_range_values prv_left ON prv_left.function_id = ps.function_idAND prv_left.boundary_id = p.partition_number - 1WHERE OBJECTPROPERTY(p.OBJECT_ID, 'ISMSSHipped') = 0AND p.index_id IN (0,1)
In this article
Please choose a monitoring environment to connect to:
Enter your email address to recover your password.
Download link successfully sent. Check your email for details.
Reset password link successfully sent to . Check your email for details.
An email with a link for creating your password is sent to
Share link successfully sent to .
Your reply is send.
Download link successfully sent to . Check your email for details.
Download link successfully sent to . Check your email for details.
Download link successfully sent to . Check your email for details.
Download link successfully sent to . Check your email for details.
We received your request. We will contact you shortly