ALTER DATABASE AUDIT SPECIFICATION (Transact-SQL)
Alters a database audit specification object using the SQL Server Audit feature. For more information, see Understanding SQL Server Audit.
ALTER DATABASE AUDIT SPECIFICATION audit_specification_name
{
[ FOR SERVER AUDIT audit_name ]
[ { { ADD | DROP } (
{ <audit_action_specification> | audit_action_group_name }
)
} [, ...n] ]
[ WITH ( STATE = { ON | OFF } ) ]
}
[ ; ]
<audit_action_specification>::=
{
<action_specification>[ ,...n ]ON [ class :: ] securable [ (column [ ,...n ] ) ]
BY principal [ ,...n ]
}
<action_specification>::=
{
action [ (column [ ,...n ] ) ]
}
Database audit specifications are non-securable objects that reside in a given database. You must set the state of an audit specification to the OFF option in order to make changes to a database audit specification. If ALTER DATABASE AUDIT SPECIFICATION is executed when an audit is enabled with any options other than STATE=OFF, you will receive an error message. For more information, see tempdb Database.
Users with the ALTER ANY DATABASE AUDIT permission can alter database audit specifications and bind them to any audit.
After a database audit specification is created, it can be viewed by principals with the CONTROL SERVER,or ALTER ANY DATABASE AUDIT permissions, the sysadmin account, or principals having explicit access to the audit.
The following example alters a database audit specification called HIPPA_Audit_DB_Specification that audits the SELECT statements by the dbo user, for a SQL Server audit called HIPPA_Audit.
ALTER DATABASE AUDIT SPECIFICATION HIPPA_Audit_DB_Specification
FOR SERVER AUDIT HIPPA_Audit
ADD (SELECT
ON Table1(Column1)
BY dbo)
WITH STATE = ON;
GO
For a full example about how to create an audit, see Understanding SQL Server Audit.
