As title, If I forgot to set the filter before run. Is there a way to filter column like application name in the middle of the recording?

I know if I save the result to trace file and reopen that file in the profiler, I will be able to edit properties to filter the result.

But to me, it makes sense to have a feature filtering the content we had in the middle of recording so I assume this functionality exists only I don't know where it is and how to do it?

  • I don't think it's possible to add Profiler filters (client or server) to a running trace. Given Profiler is deprecated, consider moving the Extended Events, which has this feature.
    – Dan Guzman
    Oct 5, 2021 at 12:03
  • @DanGuzman I'm not sure you can add a filter to a running Extended Events session. You can stop the session, modify it and restart it, much easier than what you have to do with Trace. But it's not against a live session. Although, please, show me where I'm wrong because that would be cool. Oct 5, 2021 at 12:09
  • 1
    @GrantFritchey, client filters can be added while the trace is running. Server-side filters can be added while the trace us running but it requires removing and re-adding the event(s) (e.g. ALTER EVENT SESSION YourTrace ON SERVER DROP EVENT sqlserver.sql_batch_completed;ALTER EVENT SESSION YourTrace ON SERVER ADD EVENT sqlserver.sql_batch_completed(ACTION(sqlserver.client_app_name) WHERE ([sqlserver].[client_app_name]=N'YourApp'));).
    – Dan Guzman
    Oct 5, 2021 at 12:37
  • Yeah, of course the client side. No question. As to the other, doesn't it require a final statement to restart the Session? And thanks. Oct 6, 2021 at 12:28

1 Answer 1


No. When running a trace, that trace is running. You can't add a filter after the fact. You can only, as you say, filter the results. To add the filter, stop the trace, redefine it with the filter in place and restart it.

For what it's worth, filtering in trace events is done extremely poorly internally. Instead of acting like a WHERE clause and eliminating events that don't match the filter criteria, trace captures every event that you define. Then, after using the resources to capture that event, it throws stuff away based on the filter criteria. This is highly inefficient and can absolutely negatively impact your servers.

Extended Events filters at capture, completely changing this paradigm. If you're on SQL Server 2012 or better, move to Extended Events in order to better monitor your systems and protect them at the same time.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.