12

I have a SQL Trace setup to monitor all TSQL being issued to a single database. However I only care about 'DELETE' TSQL statements being issued. Is there any way I can filter to just reporting these type of statements to the profiler? Thanks!

atconway
  • 20,624
  • 30
  • 159
  • 229

1 Answers1

18

When setting up your trace, go to event selection and select only TSQL->Batch completed. Now click the column filters button and choose TextData -> Like and write %delete%. That should do it.

EDIT: Added percent signs (%) around delete because they are needed to make it work.

Klaus Byskov Pedersen
  • 117,245
  • 29
  • 183
  • 222
  • OK did exactly that, but it did not appear to work. Not using the trace properties but if I just go to 'File' -> 'Find' and type in 'delete', search in column 'TextData' it finds the word DELETE in any part of the TSQL. If I add that filter *exactly* as you mentioned (great easy to follow directions, thanks) it does not pick up anything. Added the filter on SQL:BatchCompleted Like ---> delete. Any ideas? – atconway Oct 26 '11 at 13:55
  • 2
    Hmmmm... instead of just `delete` try `%delete%` – Klaus Byskov Pedersen Oct 26 '11 at 13:57
  • 1
    @atconway Yup... just tried it out. You definitely need the % signs. – Klaus Byskov Pedersen Oct 26 '11 at 14:05
  • 2
    For me I had to have the RPC:Completed row selected, rather than SQL:BatchCompleted as I was looking for a sproc call. – Danny Beckett Jun 23 '16 at 18:00