Query Results Overview
After you open or create a database query in the Transact-SQL (T-SQL) editor, you typically execute that query and examine the results. When you execute a query in the editor, if there are any results, they appear in the Results pane. The Results pane contains up to three tabs: Results, Messages, and Client Statistics. If you choose to display results as text, your results appear on a combined Results and Messages tab. You can resize the Results pane by using the splitter bar at the edge of the window.
Results
The Results tab displays the data that your query retrieved from the database. The data consists of one or more independent sets of results. Only queries that return results, such as a query that contains a SELECT statement or a stored procedure, display data on the Results tab. Queries that do not retrieve data, such as update queries, display a message on the Messages tab. If a query fails to execute successfully, the errors appear on the Messages tab and in the Error List window. If a query is executed successfully but no result set is returned, the Results tab does not appear.
If you choose to show results as text, then all results and messages appear on the Results and Messages tab, and the Messages tab does not appear. If you choose to save your results as a file, you are prompted for the name of the file to which your results will be saved. Messages appear on the Messages tab.
You can perform the following actions on the data that appears on the Results tab:
Copy
Copies the selected data (a cell or a range of cells) to the Clipboard.Select All
Selects all rows and columns in the list of results. You typically perform this action before you copy data.Save Results As
Saves the contents of the Results tab to a .CSV file that you specify.Properties Window
Displays the properties window.
Multiple Result Sets
If you execute a set of T-SQL statements that produce multiple result sets, the sets appear on the Results tab, separated by splitter bars. You can resize individual result sets using the splitter bars, and you can press F6 and SHIFT+F6 to navigate between the results and the panes.
Messages
The Messages tab displays any messages that the database server returns when you execute the queries. These messages include text output, such as the results of a PRINT statement. The Messages tab also includes custom messages, such as when you execute a batch using "GO 10".
Both success and failure messages appear on this tab, in the order in which the server returned them. The results of the Validate SQL Syntax command appear on the Messages tab. If you choose to display results as text, the contents of the Messages tab instead appear on the Results and Messages tab.
You can perform the following actions on the messages that appear on the Messages tab:
Copy
Copies the selected text to the Clipboard.Select All
Selects all messages. You typically perform this action before you copy messages.
Client Statistics
The Client Statistics tab contains information about each execution of a query in that instance of the T-SQL editor (even if it is a different query). A column is added every time that you run the query, and the averages are updated. Each cell indicates not only the value for that execution but also whether that value has changed. Increases are indicated by an up-arrow, and decreases by a down-arrow, and no change from the value for the previous execution is indicated by a right-arrow.
Note
Each execution adds a column to the right of the Statistic column and to the left of the columns for previous executions.
For the first execution, all results are marked as no change. Each column is labeled with the time at which the query was executed. Columns are added on the left side.
The Client Statistics tab appears only if you have chosen to include client statistics when you execute your queries. For more information, see How to: Control the Gathering and Display of Client Statistics.
You can perform the following actions on the messages that appear on the Client Statistics tab:
Copy
Copies the selected rows to the Clipboard.Select All
Selects all rows. You typically perform this action before you copy rows.
Available Statistics
The following statistics are available on the Client Statistics tab:
Rows affected by INSERT, DELETE, and UPDATE statements
The number of rows that were affected by INSERT, DELETE, or UPDATE statements that were executed as part of your query.Rows retrieved by INSERT, DELETE, and UPDATE statements
The number of rows that were retrieved by INSERT, DELETE, or UPDATE statements that were executed as a result of your query.Number of SELECT statements
The number of SELECT statements that were executed through the connection as part of your query execution. This number includes FETCH statements to retrieve rows from cursors.Rows returned by SELECT statements
The number of rows that were selected as part of your query execution. This number reflects all the rows generated by SQL statements, even those that were not actually consumed by the caller (if, for example, you cancel execution). This number also includes FETCH statements to retrieve rows from cursors.Number of transactions
The number of user transactions that were started as part of your query execution, including rollbacks.Buffers received from the server
The number of tabular data stream (TDS) packets received by the client from the database server during query execution.TDS packets sent from the client
The number of TDS packets that the client sent to the database server during query execution. Large commands can require multiple buffers. For example, if a large command is sent to the server and requires six packets, the number of server roundtrips is incremented by one, and the number of TDS packets that the client sent is incremented by six.TDS packets sent from the server
The number of TDS packets that the server sent to the client.Bytes sent from client
The number of bytes that the client sent to SQL Server during query execution.Number of server roundtrips
The number of times that the connection sent commands to the server and received a reply as part of query execution.Wait time on server replies
The cumulative amount of time (in milliseconds) that the client spent while it waited for the server to reply.Total execution time
The cumulative amount of time (in milliseconds) that the client spent processing while the query was executed, including the time that the client spent waiting for replies from the server as well as the time spent executing code.Client processing time
The cumulative amount of time that the client spent executing code while the query was executed.
See Also
Tasks
Concepts
Terminology Overview of Database Edition
Reference
Options (Database Tools/Transact-SQL Editor/Query Execution/General Page)