sp_addauditrecord allows users to enter comments into the audit trail. The syntax is:
sp_addauditrecord [text] [, db_name] [, obj name] [, owner_name] [, dbid] [, objid]
All the parameters are optional:
text – is the text of the message that you want to add to the extrainfo audit table.
db_name – is the name of the database referred to in the record, which is inserted into the dbname column of the current audit table.
obj_name – is the name of the object referred to in the record, which is inserted into the objname column of the current audit table.
owner_name – is the owner of the object referred to in the record, which is inserted into the objowner column of the current audit table.
dbid – is an integer value representing the database ID number of db_name, which is inserted into the dbid column of the current audit table. Do not place it in quotes.
objid – is an integer value representing the object ID number of obj_name. Do not place it in quotes. objid is inserted into the objid column of the current audit table.
You can use sp_addauditrecord if:
You have execute permission on sp_addauditrecord.
The auditing configuration parameter was activated with sp_configure.
The adhoc auditing option was enabled with sp_audit.
By default, only a System Security Officer and the Database Owner of sybsecurity can use sp_addauditrecord. Permission to execute it may be granted to other users.