| title | Get information about a saved trace (Transact-SQL) | |||
|---|---|---|---|---|
| description | This article describes how to use built-in functions to view information about a saved trace. | |||
| author | MashaMSFT | |||
| ms.author | mathoma | |||
| ms.reviewer | randolphwest | |||
| ms.date | 06/19/2023 | |||
| ms.service | sql | |||
| ms.topic | how-to | |||
| helpviewer_keywords |
|
[!INCLUDE SQL Server]
This article describes how to use built-in functions to view a saved trace.
Important
[!INCLUDEssNoteDepFutureAvoid] Use Extended Events instead.
-
Execute
sys.fn_trace_getinfoby specifying the ID of the trace about which information is needed. This function returns a table that lists the trace, trace property, and information about the property.Invoke the function this way:
SELECT * FROM ::fn_trace_getinfo(trace_id);
-
Execute
sys.fn_trace_getinfoby specifying0ordefault. This function returns a table that lists all the traces, their properties, and information about these properties.Invoke the function as follows:
SELECT * FROM ::fn_trace_getinfo(default);
Requires ALTER TRACE on the server.