Tuesday 27 November 2018

Extract SQL Profiler result in Excel file

There is no direct option to extract the SQL profile result in Excel or CSV file. We need to use fn_trace_gettable()  in SQL server.

Let’s see step by step how to extract SQL profiler result in excel file.
Open SQL server and profiler.


Here I am running below SQL query.
  
See it in profiler.
  
Now we need to save this result in .trc file
   
I saved this with name abc.trc file.
Now open the query window and run the below query
  
Now we can save the query result in excel or csv file.
select  * from fn_trace_gettable('D:\abc.trc',default)
   
Here I am saving it in csv format.
   
We can add the filer on the function to retrieve the profiler result for the particular user.
select TextData,ApplicationName,LoginName,StartTime,EndTime,
  ServerName,NTDomainName,NTUserName from fn_trace_gettable('D:\abc.trc',default)
  where NTUserName='Bagesh'




3 comments:

  1. Thanks for the informative and helpful post, obviously in your blog everything is good..



    download notepad++ for mac

    ReplyDelete
  2. I appreciate you taking the time and effort to share your knowledge. This material proved to be really efficient and beneficial to me. Thank you very much for providing this information. Continue to write your blog.

    Data Engineering Services 

    Machine Learning Services

    Data Analytics Services

    Data Modernization Services

    ReplyDelete

If you have any doubt, please let me know.

Popular Posts