Setting Up Auditing via T-SQL

Alternatively, you can set up auditing with T-SQL statements and also switch the audit off and on using the ALTER SERVER AUDIT command by using WITH (STATE=ON) or WITH (STATE=OFF), as shown in Listing 13.1.

Listing 13.1 Setting Up Auditing with T-SQL

image

image

It is recommended that you create your audit specifications with scripts so that you can easily manage them and not have to re-create them via SSMS dialogs.

Get Microsoft® SQL Server 2008 R2 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.