Export (0) Print
Expand All

snapshots.fn_trace_getdata (Transact-SQL)

Applies To: SQL Server 2014, SQL Server 2016 Preview

Topic Status: Some information in this topic is preview and subject to change in future releases. Preview information describes new features or changes to existing features in Microsoft SQL Server 2016 Community Technology Preview 2 (CTP2).

This function returns all the events captured for the specified trace.

Applies to: SQL Server (SQL Server 2008 through current version).

Topic link icon Transact-SQL Syntax Conventions

snapshots.fn_trace_gettable ( trace_info_id, start_time, end_time )


The unique identifier for the primary key in the snapshots.trace_info table in the management data warehouse database. trace_info_id is int.


The time that the trace started. start_time is datetime.


The time that the trace ended. end_time is datetime.

Column name

Data type


<All trace columns>


The trace data from the snapshots.trace_data table in the management data warehouse database.

A list of the columns for the specified trace can be obtained by using the following query:

SELECT * FROM sys.trace_columns

The columns that are returned by the snapshots.fn_trace_gettable function correspond to the values in the name column in the sys.trace_columns system view. The only difference is that the GroupID column is not returned by the function.

Requires SELECT permission for mdw_reader.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2015 Microsoft