Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can SQL Profiler display return result sets alongside the query?

In SQL Profiler 2005, is it possible to capture a result set in a SQL trace, so that I could see corresponding queries with result sets? ...Or is it only a one way trace?

Thanks! George

like image 916
George Johnston Avatar asked Jan 18 '10 14:01

George Johnston


People also ask

How do I display query results in SQL?

You have the option of displaying your query results on the Run SQL window, as opposed to Data Display windows. To do this, go to View > Data Grid (Ctrl+G). Once you have selected this option, a panel will appear at the bottom of the window - your query results will be displayed there.

How do I view SQL Profiler traces?

To open the trace file: Open SQL Profiler, Start > Programs > Microsoft SQL Server > Profiler. Select File > Open >Trace File. Navigate to the directory where the trace file was stored and open it.

What is the purpose of using profiler in Sqlserver?

SQL Server Profiler is an interface to create and manage traces and analyze and replay trace results. Events are saved in a trace file that can later be analyzed or used to replay a specific series of steps when diagnosing a problem.


2 Answers

No, you can't get the resultset produced by a query included in an SQL trace. You can only tell various statistics about the call (i.e. the query executed, duration, reads etc etc).

Output parameter values are recorded in the trace (if you parse TextData), and you can get it to include the rowcount info in the trace alongside the query. It just won't show you the actual resultset returned by the query.

like image 50
AdaTheDev Avatar answered Oct 05 '22 07:10

AdaTheDev


No, you can't.

But you can capture the SQL statement and parameter values (for parameterised queries) and run these manually in SQL Server Management Studio to obtain the resultset (on the assumption that the query does not modify any data obviously).

like image 41
Mitch Wheat Avatar answered Oct 05 '22 07:10

Mitch Wheat