Wednesday, 27 March 2013

How to Export SQL Profiler / Trace to SQL Server as table ?


It profiler / trace data is already saved in a .trc file, then we can read the trace file using function name ::fn_trace_gettable()

TSQL query to open a trace file in SQL Server Management Studio (SSMS)
SELECT * FROM ::fn_trace_gettable
('<<SQL Server Trace File Name>>', default)


this will display the data in result pane, so now if we want to save this in a SQL Server table then we can easily add a INTO clause in this statement and save data in SQL table as below.

SELECT * into table_name_in_which_we_want_save_data FROM ::fn_trace_gettable
('<<SQL Server Trace File Name>>', default)

No comments:

Post a Comment