T-SQL Find Number Of Records In a Partitioned Table

by Amol 25. February 2011 19:13

SELECT     

      Object_name(p.Object_ID) AS ObjectName,

      p.Partition_Number,

      prv.[Value],

      p.Rows           

FROM sys.partitions p

INNER JOIN sys.partition_range_values prv ON (p.partition_number = prv.boundary_id )

INNER JOIN sys.partition_functions pf ON (prv.function_id = pf.function_id)

WHERE p.Object_Id = Object_ID('<TableName>')

      AND p.Rows > 0

      AND pf.Name = '<PartitionFunctionName>'

Tags:

SQL Server Partitioning

Category

Recent Posts

Tag cloud