Condividi tramite


Proprietà QueueDelay

Gets or sets the amount of time in milliseconds that can elapse before audit actions are processed.

Spazio dei nomi  Microsoft.SqlServer.Management.Smo
Assembly:  Microsoft.SqlServer.Smo (in Microsoft.SqlServer.Smo.dll)

Sintassi

'Dichiarazione
<SfcPropertyAttribute(SfcPropertyFlags.Standalone)> _
Public Property QueueDelay As Integer
    Get
    Set
'Utilizzo
Dim instance As Audit
Dim value As Integer

value = instance.QueueDelay

instance.QueueDelay = value
[SfcPropertyAttribute(SfcPropertyFlags.Standalone)]
public int QueueDelay { get; set; }
[SfcPropertyAttribute(SfcPropertyFlags::Standalone)]
public:
property int QueueDelay {
    int get ();
    void set (int value);
}
[<SfcPropertyAttribute(SfcPropertyFlags.Standalone)>]
member QueueDelay : int with get, set
function get QueueDelay () : int
function set QueueDelay (value : int)

Valore proprietà

Tipo: System. . :: . .Int32
A Int32 value that specifies the number of milliseconds that can elapse before audit actions are processed.

Osservazioni

The default value, 1000 (1 second), is the minimum value that can be set. The maximum value that can be set is 2,147,483,647 milliseconds, which is equivalent to 24 days, 20 hours, 31 minutes, 23.647 seconds. The value 0 indicates synchronous delivery.

Esempi

The following code example demonstrates how to set the queue delay to 5000 milliseconds.

C#

using System;
using Microsoft.SqlServer.Management.Smo;

namespace samples
{
    class Program
    {
        static void Main(string[] args)
        {
            //Create the audit and set the queue delay
            Server dbServer = new Server("(local)");
            Audit dbAudit = new Audit(dbServer, "Test Audit");
            dbAudit.DestinationType = AuditDestinationType.File;
            dbAudit.FilePath = "C:\\AuditDirectory";
            dbAudit.QueueDelay = 5000;
            dbAudit.Create();
        }
    }
}

Powershell

#Create the audit and set the queue delay
$dbServer = new-Object Microsoft.SqlServer.Management.Smo.Server("(local)")
$dbAudit = New-Object Microsoft.SqlServer.Management.Smo.Audit($dbServer, "Test Audit")
$dbAudit.DestinationType = [Microsoft.SqlServer.Management.Smo.AuditDestinationType]'File'
$dbAudit.FilePath = "C:\AuditDirectory"
$dbAudit.QueueDelay = 5000
$dbAudit.Create()