Database Journal
MS SQL Oracle DB2 Access MySQL PostgreSQL Sybase PHP SQL Etc SQL Scripts & Samples Tips Database Forum Rss Feed

» Database Journal Home
» Database Articles
» Database Tutorials
MS Access
SQL Scripts & Samples
» Database Forum
» Slideshows
Free Newsletters:

News Via RSS Feed

Rss Feed

Database Journal |DBA Support |SQLCourse |SQLCourse2

Featured Database Articles

Posted June 28, 2021

Discarding Results of a Query Execution in SQL Server Management Studio

By Greg Larsen

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:

  1. Click on the Query menu item in SSMS.
  2. Click on the Query Option item to bring up the Query Options window.
  3. Click on the Results item in the left pane, and then check the Discard results after execution item as shown in the window below:

Screenshot shows how to discard results in SQL Server.

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.

Latest Forum Threads
DB2 Forum
Topic By Replies Updated
tables get lock during backup in db2 v9.5 Hamsoo 0 May 8th, 01:03 AM
Query to Pull Last 7 days records from a table vgoushik 0 March 20th, 06:05 PM
DB2 Visual studio addin: ANSI/Unicode problem 10Pints 0 October 5th, 02:08 AM
Things that are everbodys labor day ideas? Lipsett197 0 September 1st, 09:42 AM