Examples of adding user-defined audit records

The following example adds a record to the current audit table. The text portion is entered into the extrainfo column of the current audit table, “corporate” into the dbname column, “payroll” into the objname column, “dbo” into the objowner column, “10” into the dbid column, and “1004738270” into the objid column:

sp_addauditrecord "I gave A. Smith permission to view
the payroll table in the corporate database. This 
permission was in effect from 3:10 to 3:30 pm on 
9/22/92.", "corporate", "payroll", "dbo", 10, 
1004738270

The following example inserts information only into the extrainfo and dbname columns of the current audit table:

sp_addauditrecord @text="I am disabling auditing 
briefly while we reconfigure the system", 
@db_name="corporate"