sp_addauditrecord

Allows users to enter user-defined audit records (comments) into the audit trail.

Syntax

sp_addauditrecord [text [, db_name [, obj_name
	[, owner_name [, dbid [, objid]]]]]]

Parameters

Examples

Usage

The SAP ASE server writes all audit records to the current audit table. The current audit table is determined by the value of the current audit table configuration parameter, set with sp_configure. An installation can have up to eight system audit tables, named sysaudits_01, sysaudits_02, and so forth, through sysaudits_08.

Note: The records actually are first stored in the in-memory audit queue, and the audit process later writes the records from the audit queue to the current audit table. Therefore, you cannot count on an audit record being stored immediately in the audit table.
You can use sp_addauditrecord if:
  • You have been granted execute permission on sp_addauditrecord – no special role is required

  • Auditing is enabled – a system security officer used sp_configure to turn on the auditing configuration parameter

  • The adhoc option of sp_audit is set to on

Permissions

The permission checks for sp_addauditrecord differ based on your granular permissions settings.

SettingDescription
Enabled
With granular permissions enabled:
  • Users with execute permission on the procedure can execute sp_addauditrecord.

  • By default, sso_role has execute permission.

  • The database owner of sybsystemprocs can grant execute permission.

Disabled
With granular permissions disabled:
  • Users with execute permission on the procedure can execute sp_addauditrecord.

  • By default sso_role has execute permission.

  • Users with sa_role can grant execute permission.

  • The database owner of sybsystemprocs can grant execute permission to other users.

Auditing

Values in event and extrainfo columns from the sysaudits table are:

InformationValues
Event

1

Audit option

adhoc

Command or access audited

User-defined audit record

Information in extrainfo

extrainfo is filled by the text parameter of sp_addauditrecord

InformationValues
Event

38

Audit option

exec_procedure

Command or access audited

Execution of a procedure

Information in extrainfo
  • Roles – Current active roles

  • Keywords or options – NULL

  • Previous value – NULL

  • Current value – NULL

  • Other information – All input parameters

  • Proxy information – Original login name, if set proxy in effect

Related reference
sp_audit