locked
How do i get count of insert command executed in particular table from Database Audit for SQL Server 2012 RRS feed

  • Question

  • Is it possible to get, how many time insert command Executed in particular table from Database Audit in SQL Sever 2012 

    Prem Shah

    Monday, January 4, 2016 5:08 AM

Answers

All replies

  • I am suggesting to create Database audit using Triggers ,  Then you can design table structure according to your wish. You can run query on Database Audit table to get count of  insert Command 
    Monday, January 4, 2016 6:21 AM
  • CREATE DATABASE AUDIT SPECIFICATION audit_test_table
    FOR SERVER AUDIT test_server_audit
    ADD ( INSERT
    ON dbo.audit_test BY dbo,guest, public, db_datareader)
    WITH (STATE = ON) ;
    GO

    SELECT COUNT(*), statement
    FROM sys.fn_get_audit_file ('path to audit file.sqlaudit',default,default)
    group by statement
    GO


    Best Regards,Uri Dimant SQL Server MVP, http://sqlblog.com/blogs/uri_dimant/

    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting: Large scale of database and data cleansing
    Remote DBA Services: Improves MS SQL Database Performance
    SQL Server Integration Services: Business Intelligence

    • Marked as answer by Prem Shah Monday, January 4, 2016 6:43 AM
    Monday, January 4, 2016 6:23 AM