Compartir a través de


AutoCreateStatisticsEnabled Propiedad

Obtiene un valor de propiedad Boolean que especifica si las estadísticas se crean automáticamente para la base de datos.

Espacio de nombres:  Microsoft.SqlServer.Management.Smo
Ensamblado:  Microsoft.SqlServer.Smo (en Microsoft.SqlServer.Smo.dll)

Sintaxis

'Declaración
<SfcPropertyAttribute(SfcPropertyFlags.None Or SfcPropertyFlags.Standalone Or SfcPropertyFlags.SqlAzureDatabase Or SfcPropertyFlags.Deploy)> _
Public Property AutoCreateStatisticsEnabled As Boolean
    Get
    Set
'Uso
Dim instance As Database
Dim value As Boolean

value = instance.AutoCreateStatisticsEnabled

instance.AutoCreateStatisticsEnabled = value
[SfcPropertyAttribute(SfcPropertyFlags.None|SfcPropertyFlags.Standalone|SfcPropertyFlags.SqlAzureDatabase|SfcPropertyFlags.Deploy)]
public bool AutoCreateStatisticsEnabled { get; set; }
[SfcPropertyAttribute(SfcPropertyFlags::None|SfcPropertyFlags::Standalone|SfcPropertyFlags::SqlAzureDatabase|SfcPropertyFlags::Deploy)]
public:
virtual property bool AutoCreateStatisticsEnabled {
    bool get () sealed;
    void set (bool value) sealed;
}
[<SfcPropertyAttribute(SfcPropertyFlags.None|SfcPropertyFlags.Standalone|SfcPropertyFlags.SqlAzureDatabase|SfcPropertyFlags.Deploy)>]
abstract AutoCreateStatisticsEnabled : bool with get, set
[<SfcPropertyAttribute(SfcPropertyFlags.None|SfcPropertyFlags.Standalone|SfcPropertyFlags.SqlAzureDatabase|SfcPropertyFlags.Deploy)>]
override AutoCreateStatisticsEnabled : bool with get, set
final function get AutoCreateStatisticsEnabled () : boolean
final function set AutoCreateStatisticsEnabled (value : boolean)

Valor de la propiedad

Tipo: System. . :: . .Boolean
Valor de propiedad Boolean que especifica si las estadísticas se crean automáticamente para la base de datos.
Si es True, las estadísticas se crean automáticamente para la base de datos. En caso contrario, es False (valor predeterminado).

Implementa

IDatabaseOptions. . :: . .AutoCreateStatisticsEnabled

Comentarios

The AutoCreateStatisticsEnabled property is equivalent to setting the AUTO_CREATE_STATISTICS ON option in the ALTER DATABASE Transact-SQL statement.

Ejemplos

VB

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

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

'Display the current options for statistics.
Console.WriteLine("Automatically create statistics = " + _
db.AutoCreateStatisticsEnabled.ToString)
Console.WriteLine("Automatically update statistics = " + _
db.AutoUpdateStatisticsEnabled.ToString)

PowerShell

$srv = new-Object Microsoft.SqlServer.Management.Smo.Server("(local)")
$db = New-Object Microsoft.SqlServer.Management.Smo.Database
$db = $srv.Databases.Item("AdventureWorks2008R2")
Write-Host "Automatically create statistics =" $db.AutoCreateStatisticsEnabled
Write-Host "Automatically update statistics =" $db.AutoUpdateStatisticsEnabled