共用方式為


IndexSpaceUsed 屬性

取得索引使用的空間 (以 KB 為單位)。

命名空間:  Microsoft.SqlServer.Management.Smo
組件:  Microsoft.SqlServer.Smo (在 Microsoft.SqlServer.Smo.dll 中)

語法

'宣告
<SfcPropertyAttribute(SfcPropertyFlags.None Or SfcPropertyFlags.Expensive Or SfcPropertyFlags.Standalone)> _
Public ReadOnly Property IndexSpaceUsed As Double
    Get
'用途
Dim instance As Table
Dim value As Double

value = instance.IndexSpaceUsed
[SfcPropertyAttribute(SfcPropertyFlags.None|SfcPropertyFlags.Expensive|SfcPropertyFlags.Standalone)]
public double IndexSpaceUsed { get; }
[SfcPropertyAttribute(SfcPropertyFlags::None|SfcPropertyFlags::Expensive|SfcPropertyFlags::Standalone)]
public:
property double IndexSpaceUsed {
    double get ();
}
[<SfcPropertyAttribute(SfcPropertyFlags.None|SfcPropertyFlags.Expensive|SfcPropertyFlags.Standalone)>]
member IndexSpaceUsed : float
function get IndexSpaceUsed () : double

屬性值

型別:System. . :: . .Double
Float64 值,這個值會指定索引所使用的空間 (以 KB 為單位)。

範例

The following code example shows how to list the amount of index space used by each table in the AdventureWorks2008R2 database.

C#

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

foreach (Table tb in db.Tables) 
{
   Console.WriteLine("The " + tb.Name + " table has uses " + tb.IndexSpaceUsed.ToString() + " KB of index space.");
}

Powershell

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

Foreach ($tb in $db.Tables) 
{
   Write-Host "The" $tb.Name "table uses " $tb.IndexSpaceUsed " KB of index space."
}