Export (0) Print
Expand All
Expand Minimize

Table.PhysicalPartitions Property

Gets the physical partitions in which the table data is stored.

Namespace:  Microsoft.SqlServer.Management.Smo
Assembly:  Microsoft.SqlServer.Smo (in Microsoft.SqlServer.Smo.dll)

[SfcObjectAttribute(SfcContainerRelationship.ChildContainer, SfcContainerCardinality.OneToAny, typeof(PhysicalPartition))]
public PhysicalPartitionCollection PhysicalPartitions { get; }

Property Value

Type: Microsoft.SqlServer.Management.Smo.PhysicalPartitionCollection
A PhysicalPartitionCollection value that identifies the collection of physical partitions in which the table data is stored.

The following code example enumerates through each physical partition of each table in the AdventureWorks2012 database and displays the partitions row count.


Server srv = new Server("(local)");
Database db = srv.Databases["AdventureWorks2012"];

foreach (Table tb in db.Tables) 
   Foreach (PhysicalPartition pt in tb.PhysicalPartitions)


$srv = new-Object Microsoft.SqlServer.Management.Smo.Server("(local)")
$db = New-Object Microsoft.SqlServer.Management.Smo.Database
$db = $srv.Databases.Item("AdventureWorks2012")

Foreach ($tb in $db.Tables) 
   Foreach ($pt in $tb.PhysicalPartitions)
      Write-Host $pt.RowCount
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2015 Microsoft