TechNet
Export (0) Print
Expand All

Database.CheckAllocations Method (RepairType)

 

Scans all pages of the referenced database and tests pages to help ensure integrity.

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

Public Function CheckAllocations (
	repairType As RepairType
) As StringCollection

Parameters

repairType
Type: Microsoft.SqlServer.Management.Smo.RepairType

A RepairType object value that specifies the repair options.

Return Value

Type: System.Collections.Specialized.StringCollection

A StringCollection object value that contains a report about the allocations in the database.

This method is equivalent to the DBCC CHECKALLOC Transact-SQL statement.

VB

PowerShell

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

$sc = new-object System.Collections.Specialized.StringCollection
$sc = $db.CheckTables([Microsoft.SqlServer.Management.Smo.RepairType]'None')
$c = 0
For ($c=0; $c -le $sc.Count - 1; $c++)
{
   Write-Host $sc.Item($c)
}
Return to top
Show:
© 2016 Microsoft