次の方法で共有


Table.PhysicalPartitions プロパティ

テーブル データが格納される物理パーティションを取得します。

名前空間:  Microsoft.SqlServer.Management.Smo
アセンブリ:  Microsoft.SqlServer.Smo (Microsoft.SqlServer.Smo.dll)

構文

'宣言
<SfcObjectAttribute(SfcContainerRelationship.ChildContainer, SfcContainerCardinality.OneToAny, GetType(PhysicalPartition))> _
Public ReadOnly Property PhysicalPartitions As PhysicalPartitionCollection 
    Get
'使用
Dim instance As Table 
Dim value As PhysicalPartitionCollection 

value = instance.PhysicalPartitions
[SfcObjectAttribute(SfcContainerRelationship.ChildContainer, SfcContainerCardinality.OneToAny, typeof(PhysicalPartition))]
public PhysicalPartitionCollection PhysicalPartitions { get; }
[SfcObjectAttribute(SfcContainerRelationship::ChildContainer, SfcContainerCardinality::OneToAny, 
    typeof(PhysicalPartition))]
public:
property PhysicalPartitionCollection^ PhysicalPartitions {
    PhysicalPartitionCollection^ get ();
}
[<SfcObjectAttribute(SfcContainerRelationship.ChildContainer, SfcContainerCardinality.OneToAny, 
    typeof(PhysicalPartition))>]
member PhysicalPartitions : PhysicalPartitionCollection
function get PhysicalPartitions () : PhysicalPartitionCollection

プロパティ値

型: Microsoft.SqlServer.Management.Smo.PhysicalPartitionCollection
テーブル データが格納される物理パーティションのコレクションを識別する PhysicalPartitionCollection 値。

使用例

次のコード例では、AdventureWorks2012 データベースの各テーブルの物理パーティションをすべて列挙し、パーティションの行数を表示します。

C#

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

foreach (Table tb in db.Tables) 
{
   Foreach (PhysicalPartition pt in tb.PhysicalPartitions)
   {
      Console.WriteLine(pt.RowCount.ToString());
   }
}

Powershell

$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
   }
}

関連項目

参照

Table クラス

Microsoft.SqlServer.Management.Smo 名前空間

その他の技術情報

テーブル

CREATE TABLE (Transact-SQL)