List of sql statements that makes dml or ddl to particular table. How to know ?

  • Hi All,

    I have a question. Let's say I have a table TABLE_1. Is it possible to know which sql statement has worked on my TABLE_1 thanks.

  • Not out of the box.

    You should create an audit for that.

    -- Gianluca Sartori

  • You can get some idea of what's accessing it by querying sys.dm_exec_query_stats and combining that with sys.dm_exec_sql_text and looking for your particular table. But, that's only going to show the queries that are currently in cache. It also only shows an aggregation, not the individual calls.

    Auditing is one approach.

    You can also set up extended events to capture all the queries against a given table.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • thanks for the tips

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply