Records all data definition language (DDL) statements made to the database over time. The table is populated by a DDL trigger that fires every time a DDL statement is executed. For example, if a user created a new index or modified a table column, the occurrence of that event, including the exact Transact-SQL statement executed, is stored in the DatabaseLog table.

DatabaseLog Table Definition
The DatabaseLog table is contained in the dbo schema.
|
Column
|
Data type
|
Nullability
|
Description
|
|---|
|
DatabaseLogID
|
int
|
Not null
|
Primary key for DatabaseLog rows.
|
|
PostTime
|
datetime
|
Not null
|
Date and time the DDL statement was executed.
|
|
DatabaseUser
|
sysname
|
Not null
|
Name of the user who executed the statement.
|
|
Event
|
sysname
|
Not null
|
Type of event executed. For example, CREATE TABLE or ALTER INDEX.
|
|
Schema
|
sysname
|
Null
|
The schema that owns the modified object.
|
|
Object
|
sysname
|
Null
|
The modified object.
|
|
TSQL
|
nvarchar(max)
|
Not null
|
The Transact-SQL statement that was executed.
|
|
XmlEvent
|
xml
|
Not null
|
The event data captured by the DDL trigger including the server name, logon name, and SPID.
|

See Also