Audit.CreateDate 속성

Gets the date and time when the audit log was created.

네임스페이스:  Microsoft.SqlServer.Management.Smo
어셈블리:  Microsoft.SqlServer.Smo(Microsoft.SqlServer.Smo.dll)

구문

‘선언
<SfcPropertyAttribute(SfcPropertyFlags.Standalone)> _
Public ReadOnly Property CreateDate As DateTime 
    Get
‘사용 방법
Dim instance As Audit 
Dim value As DateTime 

value = instance.CreateDate
[SfcPropertyAttribute(SfcPropertyFlags.Standalone)]
public DateTime CreateDate { get; }
[SfcPropertyAttribute(SfcPropertyFlags::Standalone)]
public:
property DateTime CreateDate {
    DateTime get ();
}
[<SfcPropertyAttribute(SfcPropertyFlags.Standalone)>]
member CreateDate : DateTime
function get CreateDate () : DateTime

속성 값

유형: System.DateTime
A DateTime system object value that specifies the time and date when the audit log was created.

The following code example demonstrates how to get the date and time when the audit log was created and display that information on the console.

C#

using System;

using Microsoft.SqlServer.Management.Smo;

namespace samples

{

class Program

{

static void Main(string[] args)

{

//Create the audit

Server dbServer = new Server("(local)");

Audit dbAudit = new Audit(dbServer, "Test Audit");

            dbAudit.DestinationType = AuditDestinationType.File;
            dbAudit.FilePath = "C:\\AuditDirectory";

dbAudit.Create();

//Get the audit date and display it on the console

DateTime auditDate = dbAudit.CreateDate;

Console.WriteLine("The audit began at " +

auditDate.ToString());

}

}

}

Powershell

#Create the audit
$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.Create()

#Get the audit date and display it
Write-Host "The audit began at" $dbAudit.CreateDate

참고 항목

참조

Audit 클래스

Microsoft.SqlServer.Management.Smo 네임스페이스