SQL Server Profiler Filters Explained
By: Ben Snaidero
In SQL Server Profiler, filters allow you to do just what you think, filter the events that are captured in your SQL trace session. In this topic we will look at how we can apply a filter to a trace in SQL Profiler to limit the amount of data that is captured.
A filter can be applied to any data column that is part of an event you have selected. Even if the data column is not saved as a part of your SQL trace session you can still apply a filter based on it. In order to create a filter we select the "Column Filters" button on the "Events Selection" tab as shown below. Once selected the "Edit Filter" dialog will be presented. In the case below I selected the LoginName data column which provides text comparison clauses and filtered where the LoginName is like "ben". One thing to keep in mind when using the LIKE operator is that if you do not include the wildcard % it is treated like an equality (=) operator. For example, if you wanted to search for any statement executed by a login that started with "app" the you would have "app%" as your filter.
Depending on the data column you select you will see different comparison operators. As you can see with this example below the Duration data column provides numeric comparison clauses.
- Read other tips that use filters in SQL Profiler:
Last Update: 3/3/2016