共用方式為


RecalculateSpaceUsage 方法

Recalculates space usage.

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

語法

'宣告
Public Sub RecalculateSpaceUsage
'用途
Dim instance As Database

instance.RecalculateSpaceUsage()
public void RecalculateSpaceUsage()
public:
void RecalculateSpaceUsage()
member RecalculateSpaceUsage : unit -> unit 
public function RecalculateSpaceUsage()

備註

This method updates and recalculates the space used by indexes and data within the database.

範例

'Connect to the local, default instance of SQL Server.
Dim srv As Server
srv = New Server

'Reference the AdventureWorks database.
Dim db As Database
db = srv.Databases("AdventureWorks")

'Recalculate space usage.
db.RecalculateSpaceUsage()

'Display size and space information for the database.
Console.WriteLine("data space usage (KB): " + _
db.DataSpaceUsage.ToString)
Console.WriteLine("index space usage (KB): " + _
db.IndexSpaceUsage.ToString)
Console.WriteLine("space available (KB): " + _
db.SpaceAvailable.ToString)
Console.WriteLine("database size (MB): " + _
db.Size.ToString)