I found that one could use a menu to "discard" results in SSMS (TSQL language). Please see: Original Question about inhibiting results and its answer.

However, I was wondering if there is a script command that will do this, as sometimes I forget to run the command using the windows menu option.

I am using SSMS 18.8 to run the query, the actual db is older still.

PURPOSE: In this case, I am running several trials of queries to optimize them. See also: Useful optimization link


1 Answer 1


As far as I know, there isn't, because this is a feature of SSMS itself to not render the results to a UI Grid object, not a function of the T-SQL language.

That being said, you can emulate a similar outcome by selecting your results to a local #TempTable and then dropping that table right after. Then the SSMS Elapsed Time will match the actual query Execution Time, most times. (It isn't a perfect alternative, if your server faces a lot of tempdb contention, but usually that's not the case.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.