6

I want to monitor all the DML commands that run on a particular table of my database in sql server profiler. Im using sql server 2008 R2

Fraz Sundal
  • 10,288
  • 22
  • 81
  • 132

3 Answers3

10

Besides the suggested solutions, you can use a third party tool that reads SQL Server traces.

ApexSQL Comply is a SQL Server auditing tool that used SQL traces, reads relevant information from them, and stores it into its central repository database. It allows you to select the tables and event types you want to monitor. You can specify to monitor different set of events for every database.

enter image description here

It provides various built-in reports, where you can filter by a specific DML operation. It also has custom reports, so you can create your own reports.

You can set the tool to monitor just specific events on the table, or if you monitor all events, you can use the filters on the reports to show just the DML commands.

enter image description here

enter image description here

Disclaimer: I work for ApexSQL as a Support engineer

Milena Petrovic
  • 2,651
  • 21
  • 18
9

Yes sure - you might want to check out this video series by Brad McGehee:

Mastering SQL Server Profiler - Video Training Course

It's very useful and teaches you the basics and some more advanced concepts of SQL Server Profiler. Highly recommended.

Or here's the 10-minute short version by Brent Ozar: SQL Server Profiler Tutorial Video

In SQL Server Profiler, when you create a new profile trace, you can define filters. You can limit the stats being collected by a ton of different criteria - one of them being the Object Name , e.g. the table name you want to check for.

See Profiler Filters for more information on that particular topic.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
4

Depending upon your exact needs you might also want to look into extended events. This has several advantages over using SQL Profiler/ SQL Trace in terms of performance, flexibility of filters, and the information available.

If you do decide to investigate this further you might find my answer to another question useful for getting up and running.

Community
  • 1
  • 1
Martin Smith
  • 438,706
  • 87
  • 741
  • 845