Have you ever been testing a query in SQL Server Management Studio (SSMS) and you really didn’t want to see all the rows of output coming back in the result window? Well, if you have then there is a way to turn off those distracting results when you run your query.
You might ask why would you want to do that?
One reason is that you might want to do some performance testing and the results of the query themselves are not important. By discarding the results of your query, you are testing the performance of the query at the server itself, without taking into account the time it takes to send all the bits in the result set across the network.
To discard the results of a query within SQL Server Management Studio (SSMS) perform the following steps:
- Click on the Query menu item in SSMS.
- Click on the Query Option item to bring up the Query Options window.
- Click on the Results item in the left pane, and then check the Discard results after execution item as shown in the window below:
Once you do this, click on the “OK” button to make this query option stick. After doing this any query you run will discard the result set when it is executed. All you will get is the number of rows affected by the query. Don’t forget to turn off this option, by unclicking the option, should you eventually want to start seeing the complete results.