| title | sys.fn_trace_getinfo (Transact-SQL) | ||||
|---|---|---|---|---|---|
| description | sys.fn_trace_getinfo (Transact-SQL) | ||||
| author | rwestMSFT | ||||
| ms.author | randolphwest | ||||
| ms.date | 08/09/2016 | ||||
| ms.service | sql | ||||
| ms.subservice | system-objects | ||||
| ms.topic | reference | ||||
| f1_keywords |
|
||||
| helpviewer_keywords |
|
||||
| dev_langs |
|
[!INCLUDE SQL Server]
Returns information about a specified trace or all existing traces.
Important
[!INCLUDEssNoteDepFutureAvoid] Use Extended Events instead.
:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: Transact-SQL syntax conventions
sys.fn_trace_getinfo ( { trace_id | NULL | 0 | DEFAULT } )
trace_id
Is the ID of the trace. trace_id is int. Valid inputs are the ID number of a trace, NULL, 0, or DEFAULT. NULL, 0, and DEFAULT are equivalent values in this context. Specify NULL, 0, or DEFAULT to return information for all traces in the instance of [!INCLUDEssNoVersion].
| Column name | Data type | Description |
|---|---|---|
| traceid | int | ID of the trace. |
| property | int | Property of the trace: 1= Trace options. For more information, see @options in sp_trace_create (Transact-SQL). 2 = File name 3 = Max size 4 = Stop time 5 = Current trace status. 0 = stopped. 1 = running. |
| value | sql_variant | Information about the property of the trace specified. |
When passed the ID of a specific trace, fn_trace_getinfo returns information about that trace. When passed an invalid ID, this function returns an empty rowset.
fn_trace_getinfo appends a .trc extension to the name of any trace file included in its result set. For information on defining a trace, see sp_trace_create (Transact-SQL). For similar information about trace filters, see sys.fn_trace_getfilterinfo (Transact-SQL).
For a complete example of using trace stored procedures, see Create a Trace (Transact-SQL).
Requires ALTER TRACE permission on the server.
The following example returns information about all active traces.
SELECT * FROM sys.fn_trace_getinfo(0) ;
GO
Create a Trace (Transact-SQL)
sp_trace_create (Transact-SQL)
sp_trace_generateevent (Transact-SQL)
sp_trace_setevent (Transact-SQL)
sp_trace_setfilter (Transact-SQL)
sp_trace_setstatus (Transact-SQL)
sys.fn_trace_getfilterinfo (Transact-SQL)
sys.fn_trace_geteventinfo (Transact-SQL)
sys.fn_trace_gettable (Transact-SQL)