Specifies the application filter, or the applications to include or exclude for the trace specified. Microsoft® SQL Server™ captures the required information, configured by executing xp_trace_seteventclassrequired, for the included applications, if any, and does not capture the required information for the excluded applications, if any.
xp_trace_setappfilter {queue_handle, 'include_only_applications',
'exclude_applications'}
Value | Description |
---|---|
MS SQLEM | SQL Server Enterprise Manager |
Microsoft SQL Server Query Analyzer | SQL Server Query Analyzer |
xpsqlweb.dll | Web Assistant Wizard |
0 (success) or >1 (failure)
xp_trace_setappfilter returns this message:
The command(s) completed successfully.
When you specify one or more applications to include, all other applications are excluded.
Note The event class list can be generated using xp_trace_geteventnames.
Execute permissions for xp_trace_setappfilter default to members of the sysadmin fixed server role but can be granted to other users.
This example executes xp_trace_setappfilter to include events from SQL Server Query Analyzer and SQL Server Enterprise Manager.
USE master
DECLARE @queue_handle int, @column_value int
SET @column_value = 16|32|8192|128|512
EXEC xp_trace_addnewqueue 1000,
5,
95,
90,
@column_value,
@queue_handle OUTPUT
EXEC xp_trace_setappfilter @queue_handle,
'Microsoft SQL Server Query Ana%;MS SQLEM%',
NULL
This example executes xp_trace_setappfilter to only include events from SQL Server Query Analyzer.
USE master
DECLARE @queue_handle int, @column_value int
SET @column_value = 16|32|8192|128|512
EXEC xp_trace_addnewqueue 1000,
5,
95,
90,
@column_value,
@queue_handle OUTPUT
EXEC xp_trace_setappfilter @queue_handle,
'Microsoft SQL Server Query Ana%',
'SQL Server Profiler%'
Monitoring with SQL Server Profiler | xp_trace_getappfilter |
xp_trace_addnewqueue | xp_trace_getqueueproperties |
xp_trace_enumqueuehandles | System Stored Procedures (SQL Server Profiler Extended Procedures) |