Was this page helpful?
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Collapse the table of content
Expand the table of content
Expand Minimize

Table.IndexSpaceUsed Property


Gets the space used by the index, in KB.

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

[SfcPropertyAttribute(SfcPropertyFlags.None | SfcPropertyFlags.Expensive | SfcPropertyFlags.Standalone | SfcPropertyFlags.Matrix)]
public double IndexSpaceUsed { get; }

Property Value

Type: System.Double

A T:System.Float64 value that specifies space used by the index, in KB.

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


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

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


$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) 
   Write-Host "The" $tb.Name "table uses " $tb.IndexSpaceUsed " KB of index space."
Return to top
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
© 2015 Microsoft