Table.PartitionScheme Table.PartitionScheme Table.PartitionScheme Property

Definition

Important

This API is not CLS-compliant.

Gets or sets the name of the partition scheme that is configured for the table.

public:
 property System::String ^ PartitionScheme { System::String ^ get(); void set(System::String ^ value); };
[Microsoft.SqlServer.Management.Sdk.Sfc.Metadata.SfcProperty(Microsoft.SqlServer.Management.Sdk.Sfc.Metadata.SfcPropertyFlags.ReadOnlyAfterCreation | Microsoft.SqlServer.Management.Sdk.Sfc.Metadata.SfcPropertyFlags.Standalone | Microsoft.SqlServer.Management.Sdk.Sfc.Metadata.SfcPropertyFlags.SqlAzureDatabase)]
[Microsoft.SqlServer.Management.Sdk.Sfc.Metadata.SfcReference(typeof(Microsoft.SqlServer.Management.Smo.PartitionScheme), "Server[@Name='{0}']/Database[@Name='{1}']/PartitionScheme[@Name='{2}']", Mono.Cecil.CustomAttributeArgument[])]
[System.CLSCompliant(false)]
public string PartitionScheme { get; set; }
Public Property PartitionScheme As String
Property Value

A String value that specifies the name of the partition scheme that is configured on the table.

Examples

The following code example prints the name of the partition scheme, if one exists, for each AdventureWorks2012 table.

C#

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

foreach (Table tb in db.Tables)   
{  
   if (tb.PartitionScheme != "")  
   {  
      Console.WriteLine("The " + tb.Name + " table uses the " + tb.PartitionScheme + " partition scheme.");  
   }  
   else  
   {  
      Console.WriteLine("The " + tb.Name + " table has no defined partition scheme.");  
   }  
}  

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)   
{  
   if ($tb.PartitionScheme -ne "")  
   {  
      Write-Host "The" $tb.Name "table uses the" $tb.PartitionScheme "partition scheme."  
   }  
   else  
   {  
   Write-Host "The" $tb.Name "table has no defined partition scheme."   
   }  
}  

Remarks

The property specifies the name of the partition scheme. The PartitionSchemeParameters property lists the file groups that the partition scheme uses to store the table data.

Applies to