How to get accurate row counts in partitions in a table I am trying to fetch row counts in each partition for a table. But I got confused as in sys.partitions row counts is on basis of indexes.

So how can I get exact row count for partitions in a table.
You need to ignore index_id with values that are not 0 (heap) or 1 (clustered index)

SELECT rows  FROM sys.partitions 
WHERE object_id = object_id('name of table') 
AND index_id &lt; 2