Skip to content

Commit bfcc651

Browse files
committed
Refresh some trace filtering articles (UUF 270785)
1 parent e897d06 commit bfcc651

6 files changed

Lines changed: 263 additions & 270 deletions

File tree

docs/relational-databases/sql-trace/filter-a-trace.md

Lines changed: 150 additions & 162 deletions
Large diffs are not rendered by default.
Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,35 @@
11
---
2-
title: "Set a Trace Filter (Transact-SQL)"
3-
description: "Set a Trace Filter (Transact-SQL)"
2+
title: "Set a trace filter (Transact-SQL)"
3+
description: Learn how to use stored procedures to create a filter that retrieves only the information you need on an event being traced.
44
author: "MashaMSFT"
55
ms.author: "mathoma"
6-
ms.date: "03/06/2017"
6+
ms.reviewer: randolphwest
7+
ms.date: 07/17/2024
78
ms.service: sql
89
ms.topic: conceptual
910
helpviewer_keywords:
1011
- "filters [SQL Server], traces"
1112
- "traces [SQL Server], filters"
1213
---
13-
# Set a Trace Filter (Transact-SQL)
14-
[!INCLUDE [SQL Server](../../includes/applies-to-version/sqlserver.md)]
15-
This topic describes how to use stored procedures to create a filter that retrieves only the information you need on an event being traced.
16-
17-
### To set a trace filter
18-
19-
1. If the trace is already running, execute **sp_trace_setstatus** by specifying `@status = 0` to stop the trace.
20-
21-
2. Execute **sp_trace_setfilter** to configure the type of information to retrieve for the event being traced.
14+
# Set a trace filter (Transact-SQL)
15+
16+
[!INCLUDE [SQL Server](../../includes/applies-to-version/sqlserver.md)]
17+
18+
This article describes how to use stored procedures to create a filter that retrieves only the information you need on an event being traced.
19+
20+
## Set a trace filter
21+
22+
1. If the trace is already running, execute `sp_trace_setstatus` by specifying `@status = 0` to stop the trace.
23+
24+
1. Execute `sp_trace_setfilter` to configure the type of information to retrieve for the event being traced.
2225

2326
> [!IMPORTANT]
24-
> Unlike regular stored procedures, parameters of all [!INCLUDE[ssSqlProfiler](../../includes/sssqlprofiler-md.md)] stored procedures (**sp_trace\__xx_**) are strictly typed and do not support automatic data type conversion. If these parameters are not called with the correct input parameter data types, as specified in the argument description, the stored procedure will return an error.
25-
26-
## See Also
27-
[Filter a Trace](../../relational-databases/sql-trace/filter-a-trace.md)
28-
[sp_trace_setfilter (Transact-SQL)](../../relational-databases/system-stored-procedures/sp-trace-setfilter-transact-sql.md)
29-
[sp_trace_setstatus (Transact-SQL)](../../relational-databases/system-stored-procedures/sp-trace-setstatus-transact-sql.md)
30-
[System Stored Procedures (Transact-SQL)](../../relational-databases/system-stored-procedures/system-stored-procedures-transact-sql.md)
31-
[SQL Server Profiler Stored Procedures (Transact-SQL)](../../relational-databases/system-stored-procedures/sql-server-profiler-stored-procedures-transact-sql.md)
32-
33-
27+
> Unlike regular stored procedures, parameters of all [!INCLUDE [ssSqlProfiler](../../includes/sssqlprofiler-md.md)] stored procedures (`sp_trace_*`) are strictly typed and don't support automatic data type conversion. If these parameters aren't called with the correct input parameter data types, as specified in the argument description, the stored procedure will return an error.
28+
29+
## Related content
30+
31+
- [Filter a trace](filter-a-trace.md)
32+
- [sp_trace_setfilter (Transact-SQL)](../system-stored-procedures/sp-trace-setfilter-transact-sql.md)
33+
- [sp_trace_setstatus (Transact-SQL)](../system-stored-procedures/sp-trace-setstatus-transact-sql.md)
34+
- [System stored procedures (Transact-SQL)](../system-stored-procedures/system-stored-procedures-transact-sql.md)
35+
- [SQL Server Profiler stored procedures (Transact-SQL)](../system-stored-procedures/sql-server-profiler-stored-procedures-transact-sql.md)

docs/toc.yml

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6572,33 +6572,33 @@ items:
65726572
- name: SQL Trace
65736573
href: relational-databases/sql-trace/sql-trace.md
65746574
items:
6575-
- name: Create & Run Traces Using T-SQL Stored Procedures
6575+
- name: Create & run traces using T-SQL stored procedures
65766576
href: relational-databases/sql-trace/create-and-run-traces-using-transact-sql-stored-procedures.md
6577-
- name: Create Manual Traces using Stored Procedures
6577+
- name: Create manual traces using stored procedures
65786578
href: relational-databases/sql-trace/create-manual-traces-using-stored-procedures.md
6579-
- name: Save Trace Results to a File
6579+
- name: Save trace results to a file
65806580
href: relational-databases/sql-trace/save-trace-results-to-a-file.md
6581-
- name: Improve Access to Trace Data
6581+
- name: Improve access to trace data
65826582
href: relational-databases/sql-trace/improve-access-to-trace-data.md
6583-
- name: Create a Trace (T-SQL)
6583+
- name: Create a trace (T-SQL)
65846584
href: relational-databases/sql-trace/create-a-trace-transact-sql.md
6585-
- name: Set a Trace Filter (T-SQL)
6585+
- name: Set a trace filter (T-SQL)
65866586
href: relational-databases/sql-trace/set-a-trace-filter-transact-sql.md
6587-
- name: Modify an Existing Trace (T-SQL)
6587+
- name: Modify an existing Trace (T-SQL)
65886588
href: relational-databases/sql-trace/modify-an-existing-trace-transact-sql.md
6589-
- name: View a Saved Trace (T-SQL)
6589+
- name: View a saved trace (T-SQL)
65906590
href: relational-databases/sql-trace/view-a-saved-trace-transact-sql.md
6591-
- name: View Filter Information (T-SQL)
6591+
- name: View filter information (T-SQL)
65926592
href: relational-databases/sql-trace/view-filter-information-transact-sql.md
6593-
- name: Delete a Trace (T-SQL)
6593+
- name: Delete a trace (T-SQL)
65946594
href: relational-databases/sql-trace/delete-a-trace-transact-sql.md
6595-
- name: Optimize SQL Trace
6595+
- name: Optimize SQL trace
65966596
href: relational-databases/sql-trace/optimize-sql-trace.md
6597-
- name: Filter a Trace
6597+
- name: Filter a trace
65986598
href: relational-databases/sql-trace/filter-a-trace.md
6599-
- name: Limit Trace File & Table Sizes
6599+
- name: Limit trace file & table sizes
66006600
href: relational-databases/sql-trace/limit-trace-file-and-table-sizes.md
6601-
- name: Schedule Traces
6601+
- name: Schedule traces
66026602
href: relational-databases/sql-trace/schedule-traces.md
66036603
- name: Query Store
66046604
items:
@@ -9897,20 +9897,21 @@ items:
98979897
href: tools/sql-server-profiler/analyze-deadlocks-with-sql-server-profiler.md
98989898
- name: Analyze Queries with SHOWPLAN Results in SQL Server Profiler
98999899
href: tools/sql-server-profiler/analyze-queries-with-showplan-results-in-sql-server-profiler.md
9900-
- name: Filter Traces
9901-
href: tools/sql-server-profiler/filter-traces-with-sql-server-profiler.md
9900+
- name: Filter traces
99029901
items:
9903-
- name: Filter Events in a Trace
9902+
- name: Overview
9903+
href: tools/sql-server-profiler/filter-traces-with-sql-server-profiler.md
9904+
- name: Filter events in a trace
99049905
href: tools/sql-server-profiler/filter-events-in-a-trace-sql-server-profiler.md
9905-
- name: View Filter Information
9906+
- name: View filter information
99069907
href: tools/sql-server-profiler/view-filter-information-sql-server-profiler.md
9907-
- name: Modify a Filter
9908+
- name: Modify a filter
99089909
href: tools/sql-server-profiler/modify-a-filter-sql-server-profiler.md
9909-
- name: Filter Events Based on the Event Start Time
9910+
- name: Filter events based on the event start time
99109911
href: tools/sql-server-profiler/filter-events-based-on-the-event-start-time-sql-server-profiler.md
9911-
- name: Filter Events Based on the Event End Time
9912+
- name: Filter events based on the event end time
99129913
href: tools/sql-server-profiler/filter-events-based-on-the-event-end-time-sql-server-profiler.md
9913-
- name: Filter Server Process IDs (SPIDs) in a Trace
9914+
- name: Filter server process IDs (SPIDs) in a trace
99149915
href: tools/sql-server-profiler/filter-server-process-ids-spids-in-a-trace-sql-server-profiler.md
99159916
- name: Save traces & templates
99169917
href: tools/sql-server-profiler/save-traces-and-trace-templates.md
Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,59 @@
11
---
2-
title: Filter Events in a Trace
2+
title: Filter events in a trace
33
titleSuffix: SQL Server Profiler
44
description: Find out how to set a filter to limit the events that SQL Server Profiler captures during a trace. Read about the formats required for certain filters.
55
author: markingmyname
66
ms.author: maghan
7-
ms.date: 04/11/2023
7+
ms.reviewer: randolphwest
8+
ms.date: 07/17/2024
89
ms.service: sql
910
ms.subservice: profiler
1011
ms.topic: conceptual
1112
---
1213

13-
# Filter Events in a Trace (SQL Server Profiler)
14+
# Filter events in a trace (SQL Server Profiler)
1415

1516
[!INCLUDE [SQL Server Azure SQL Managed Instance](../../includes/applies-to-version/sql-asdbmi.md)]
1617

17-
Filters limit the events collected in a trace. If a filter is not set, all events of the selected event classes are returned in the trace output. It is not mandatory to set a filter for a trace. However, a filter minimizes the overhead that is incurred during tracing.
18+
Filters limit the events collected in a trace. If a filter isn't set, all events of the selected event classes are returned in the trace output. It's not mandatory to set a filter for a trace. However, a filter minimizes the overhead that is incurred during tracing.
1819

19-
You add filters to trace definitions by using the **Events Selection** tab of the **Trace Properties** or **Trace Template Properties** dialog box.
20+
You add filters to trace definitions by using the **Events Selection** tab of the **Trace Properties** or **Trace Template Properties** dialog box.
2021

2122
## Filter events in a trace
2223

2324
1. In the **Trace Properties** or **Trace Template Properties** dialog box, select the **Events Selection** tab.
2425

25-
The **Events Selection** tab contains a grid control. The grid control is a table that contains each of the traceable event classes. The table contains one row for each event class. The event classes may differ slightly, depending on the type and version of server to which you are connected. The event classes are identified in the **Events** column of the grid and are grouped by event category. The remaining columns list the data columns that can be returned for each event class.
26+
The **Events Selection** tab contains a grid control. The grid control is a table that contains each of the traceable event classes. The table contains one row for each event class. The event classes might differ slightly, depending on the type and version of server to which you connect. The event classes are identified in the **Events** column of the grid and are grouped by event category. The remaining columns list the data columns that can be returned for each event class.
2627

2728
1. Select **Column Filters.**
2829

29-
The **Edit Filter** dialog box appears. The **Edit Filter** dialog box contains a list of comparison operators that you can use to filter events in a trace.
30+
The **Edit Filter** dialog box appears. The **Edit Filter** dialog box contains a list of comparison operators that you can use to filter events in a trace.
3031

3132
1. To apply a filter, select the comparison operator, and type a value to use for the filter.
3233

3334
1. Select **OK**.
3435

35-
**Considerations:**
36+
### Considerations
3637

37-
- If you set filter conditions on the **StartTime** and **EndTime** data columns of the Events Selection tab, then make sure that:
38+
If you set filter conditions on the **StartTime** and **EndTime** data columns of the Events Selection tab, then make sure that:
3839

39-
- The date you enter matches this format: `YYYY/MM/DD HH:mm:sec`.
40+
- The date you enter matches this format: `YYYY/MM/DD HH:mm:sec`.
4041

41-
-OR-
42+
-OR-
4243

43-
- **Use regional settings to display date and time values** is checked in the **General Options** dialog box. To view the **General Options** dialog box, on the [!INCLUDE[ssSqlProfiler](../../includes/sssqlprofiler-md.md)] **Tools** menu, select **Option**.
44+
- **Use regional settings to display date and time values** is checked in the **General Options** dialog box. To view the **General Options** dialog box, on the [!INCLUDE [ssSqlProfiler](../../includes/sssqlprofiler-md.md)] **Tools** menu, select **Option**.
4445

45-
-AND-
46+
-AND-
4647

47-
- The date you enter is between January 1, 1753 and December 31, 9999.
48+
- The date you enter is between January 1, 1753 and December 31, 9999.
4849

49-
- If tracing events from the **osql** utility or from the **sqlcmd** utility, always append **%** to filters on the **TextData** data column.
50+
If tracing events from the **osql** utility or from the **sqlcmd** utility, always append **%** to filters on the **TextData** data column.
5051

51-
> [!NOTE]
52-
> The checkbox for **Exclude rows that do not contain values** may filter out rows with:
53-
>
54-
> - NULL values
55-
> - Empty strings (which technically are values)
52+
The checkbox for **Exclude rows that don't contain values** might filter out rows with the following conditions, while NOT filtering out events where the column itself isn't present:
5653

57-
while NOT filtering out events where the column itself is not present.
54+
- `NULL` values
55+
- Empty strings (which technically are values)
5856

59-
## Next steps
57+
## Related content
6058

61-
- [SQL Server Profiler](../../tools/sql-server-profiler/sql-server-profiler.md)
59+
- [SQL Server Profiler](sql-server-profiler.md)

docs/tools/sql-server-profiler/filter-traces-with-sql-server-profiler.md

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,25 @@ titleSuffix: SQL Server Profiler
44
description: Find out how to define a filter so that SQL Server Profiler gathers the information you need during traces. Read about other advantages of trace filters.
55
author: markingmyname
66
ms.author: maghan
7-
ms.date: 03/01/2017
7+
ms.reviewer: randolphwest
8+
ms.date: 07/17/2024
89
ms.service: sql
910
ms.subservice: profiler
1011
ms.topic: conceptual
1112
---
1213

13-
# Filter Traces with SQL Server Profiler
14-
[!INCLUDE [SQL Server Azure SQL Managed Instance](../../includes/applies-to-version/sql-asdbmi.md)]
15-
You can define filters on data columns for [!INCLUDE[ssSqlProfiler](../../includes/sssqlprofiler-md.md)] trace events so that information is captured only for those events that you are interested in. Trace filters reduce the impact of tracing on system performance because fewer events are captured in the trace. Filtering also makes trace output easier to read because there are fewer events to search through.
16-
17-
**To filter traces with SQL Server Profiler**
18-
19-
[Filter Events in a Trace (SQL Server Profiler)](../../tools/sql-server-profiler/filter-events-in-a-trace-sql-server-profiler.md)
20-
21-
## See Also
22-
[Filter a Trace](../../relational-databases/sql-trace/filter-a-trace.md)
23-
24-
14+
# Filter traces with SQL Server Profiler
15+
16+
[!INCLUDE [SQL Server Azure SQL Managed Instance](../../includes/applies-to-version/sql-asdbmi.md)]
17+
18+
You can define filters on data columns for [!INCLUDE [ssSqlProfiler](../../includes/sssqlprofiler-md.md)] trace events so that information is captured only for those events that you're interested in. Trace filters reduce the effect of tracing on system performance because fewer events are captured in the trace. Filtering also makes trace output easier to read because there are fewer events to search through.
19+
20+
## Filter events in a trace with SQL Server Profiler
21+
22+
- [Filter events in a trace (SQL Server Profiler)](filter-events-in-a-trace-sql-server-profiler.md)
23+
- [Modify a filter (SQL Server Profiler)](modify-a-filter-sql-server-profiler.md)
24+
25+
## Related content
26+
27+
- [Filter a trace](../../relational-databases/sql-trace/filter-a-trace.md)
28+
- [Set a trace filter (Transact-SQL)](../../relational-databases/sql-trace/set-a-trace-filter-transact-sql.md)
Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
11
---
2-
title: Modify a Filter
2+
title: Modify a filter
33
titleSuffix: SQL Server Profiler
44
description: Learn how to modify a trace filter in SQL Server Profiler so you can gather the information you need. Read about how trace filters affect database performance.
55
author: markingmyname
66
ms.author: maghan
7-
ms.date: 03/01/2017
7+
ms.reviewer: randolphwest
8+
ms.date: 07/17/2024
89
ms.service: sql
910
ms.subservice: profiler
1011
ms.topic: conceptual
1112
---
1213

13-
# Modify a Filter (SQL Server Profiler)
14-
15-
[!INCLUDE [SQL Server Azure SQL Managed Instance](../../includes/applies-to-version/sql-asdbmi.md)]
16-
17-
You add filters to trace templates, which contain the trace definitions, to limit the number of events that are gathered by a trace. Limiting the number of events gathered can reduce the performance effects of tracing. If you set filters for a trace template and find that the trace is not gathering the kind of information that you need, you can edit the filter.
18-
19-
### To modify a filter
20-
21-
1. In [!INCLUDE[ssSqlProfiler](../../includes/sssqlprofiler-md.md)], open the template for the trace filter that you want to modify. On the **File** menu, click **Templates**, and then choose **Edit Template**.
22-
23-
2. In the **General** tab of the **Trace Template Properties** dialog, select a template from the **Select template name** list.
24-
25-
3. Click the **Events Selection** tab.
26-
27-
The **Events Selection** tab contains a grid control. The grid control is a table that contains each of the traceable event classes. The table contains one row for each event class. The event classes may differ slightly, depending on the type and version of server to which you are connected. The event classes are identified in the **Events**column of the grid and are grouped by event category. The remaining columns list the data columns that can be returned for each event class.
28-
29-
4. Click **Column Filters**.
30-
31-
5. In the **Edit Filter** dialog box, click the value next to the comparison operator that you want to edit, and type the new value or delete a value. You can also add additional filters.
32-
33-
6. Click **OK** and save the template.
34-
35-
## See Also
36-
[SQL Server Profiler](../../tools/sql-server-profiler/sql-server-profiler.md)
37-
38-
14+
# Modify a filter (SQL Server Profiler)
15+
16+
[!INCLUDE [SQL Server Azure SQL Managed Instance](../../includes/applies-to-version/sql-asdbmi.md)]
17+
18+
You add filters to trace templates, which contain the trace definitions, to limit the number of events gathered by a trace. Limiting the number of events gathered can reduce the performance effects of tracing. If you set filters for a trace template, and find that the trace isn't gathering the kind of information that you need, you can edit the filter.
19+
20+
## Modify a filter
21+
22+
1. In [!INCLUDE [ssSqlProfiler](../../includes/sssqlprofiler-md.md)], open the template for the trace filter that you want to modify. On the **File** menu, select **Templates**, and then choose **Edit Template**.
23+
24+
1. In the **General** tab of the **Trace Template Properties** dialog, select a template from the **Select template name** list.
25+
26+
1. Select the **Events Selection** tab.
27+
28+
The **Events Selection** tab contains a grid control. The grid control is a table that contains each of the traceable event classes. The table contains one row for each event class. The event classes might differ slightly, depending on the type and version of server to which you connect. The event classes are identified in the **Events** column of the grid and are grouped by event category. The remaining columns list the data columns that can be returned for each event class.
29+
30+
1. Select **Column Filters**.
31+
32+
1. In the **Edit Filter** dialog box, select the value next to the comparison operator that you want to edit, and type the new value or delete a value. You can also add extra filters.
33+
34+
1. Select **OK** and save the template.
35+
36+
## Related content
37+
38+
- [SQL Server Profiler](sql-server-profiler.md)

0 commit comments

Comments
 (0)