sp_audit_write (Transact-SQL)
SQL Server 2012
Adds a user-defined audit event to the USER_DEFINED_AUDIT_GROUP. If USER_DEFINED_AUDIT_GROUP is not enabled, sp_audit_write is ignored.
A. Creating a user-defined audit event with informational text
The following example creates an audit event with the id 27, the succeeded value of 0, and included optional informational text.
EXEC sp_audit_write @user_defined_event_id = 27 , @succeeded = 0 , @user_defined_information = N'Access to a monitored object.' ;
B. Creating a user-defined audit event without informational text
The following example creates an audit event with the id 27, the succeeded value of 0, and does not include optional informational text or the optional parameter names.
EXEC sp_audit_write 27, 0;
