Returns the number of data pages used by a partition.
ptn_data_pgs(object_id, partition_id)
is the object ID for a table, stored in the id column of sysobjects, sysindexes, and syspartitions.
is the partition number of a table.
select ptn_data_pgs(object_id("salesdetail"), 1)
----------- 5
ptn_data_pgs, a system function, returns the number of data pages in a partitioned table.
Use the object_id function to get an object’s ID, and use sp_helpartiton to list the partitions in a table.
The data pages returned by ptn_data_pgs may be inaccurate. Use the update partition statistics, dbcc checktable, dbcc checkdb, or dbcc checkalloc commands before using ptn_data_pgs to get the most accurate value.
For general information about system functions, see “System functions”.
SQL92 – Compliance level: Transact-SQL extension.
Only the table owner can execute ptn_data_pgs.
Commands update partition statistics, dbcc
System procedures sp_helpartition