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

Leave a comment (0) Go to comments

I am running a running a SQL Server Profiler, a graphical tool to track SQL Server Activities, I am done with my analysis but prior to close SQL Server Profiler Tool, Can I save the result in SQL Server or in Excel ?

Can I export SQL Server Profile / Trace file data to SQL Server as a table data ?

How can I download SQL Server Profiler / Trace data in SQL Server Table ?

YES, we can export SQL Server Trace / Profiler data into a SQL Server Table. There are various ways to export SQL Server Profiler / Trace data to a SQL Server table.

Method 1Graphical

By default the SQL Server profiler / trace data will be displayed in SQL Server Profiler tool, as shown picture below.

How to Export SQL Profiler / Trace to SQL Server as table ? export SQL Server Profile / Trace file data to SQL Server as a table data download SQL Server Profiler / Trace data in SQL Server Table


To export this data in SQL Server, select File Menu >> SAVE AS and finally opt Trace Table as shown below. 

How to Export SQL Profiler / Trace to SQL Server as table ? export SQL Server Profile / Trace file data to SQL Server as a table data download SQL Server Profiler / Trace data in SQL Server Table

Once you select Trace Table, SQL Server Authentication window will come and ask your on which Server / Database Name and table, in which you want to export the database, this will automatically create a table, if that doesn’t;t exists.

How to Export SQL Profiler / Trace to SQL Server as table ? export SQL Server Profile / Trace file data to SQL Server as a table data download SQL Server Profiler / Trace data in SQL Server Table

Method 2Using TSQL Statement

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) 
EOF - How to Export SQL Profiler / Trace to SQL Server as table ?, SQL Server 2012 , 2008 R2 , 2008 , 2005 , 2000

Leave a Reply

Your email address will not be published. Required fields are marked *


*


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Notify me of followup comments via e-mail. You can also subscribe without commenting.