Would it be possible to have a "cancel" button somewhere while the "Hold tight while we fetch your results..." text is being displayed?

The thing is, I occasionally (rarely, very rarely!) make a mistake.

Specifically, sometimes I click "Run Query" in the Data Explorer, and then immediately realize I've left something out, or misspelled something in a WHERE clause, etc - some simple mistake.

Considering the timeout for queries is 2 minutes, that can be rather frustrating (especially while tweaking a complicated query). It would be great to be able to cancel that query, make the quick fix, and resubmit.

I'd be okay with the "cancel" button not being available until a certain amount of time had passed without results from the query (5, 10, 15 seconds? Anything less than 2 minutes, I suppose).

Oh, and Tim Stone can't complain about this, because it was totally his idea.

  • 2
    Obligatory =) Jul 20, 2012 at 19:37
  • 2
    I call this the "Oh $%^& button" and am glad to have it in SQL Server Management Studio...
    – Ben Brocka
    Jul 20, 2012 at 20:29
  • 1
    Yeah, I forget a TOP(n) all the time, and then... this.
    – Ry-
    Jul 21, 2012 at 1:06
  • @BenBrocka I'm definitely calling it that from now on. Jul 23, 2012 at 3:38

1 Answer 1


Sam had already done the hard work of making the query run as an asynchronous process, so I just went ahead and hacked something together to allow for user cancellation. The feature works with the following points in mind:

  • The cancel button isn't enabled until after the first poll for results
  • If your query has already executed and is in the process of returning results, you'll get the results back anyway
  • If your query has multiple sections (split by GO, for instance) and you cancel it after some of those sections have completed, you'll get the results of those sections where applicable
  • There's a slight chance that if you cancel a query that would have caused the server to throw an exception, you might not get that error message (hopefully unlikely)

In the typical case where you just have a single query that you're cancelling before it's gotten to the result set processing stage, you get a message like the following:

query execution cancelled message

Note that your execution of the query is still logged even when you cancel the process, to monitor for abuse.

Thanks for turning this into an actual request to prompt me to get it taken care of!

  • Hmm, actually in the case where you get the message it probably doesn't correctly show you that a new revision was created regardless...I will preemptively fix that bug in a bit.
    – Tim Stone
    Jul 22, 2012 at 1:03
  • 1
    Will go out in some build, sometime, version > ...Oh, wait, there isn't a version number in Data Explorer's footer! Go support that if you'd (general "you", since it seems that jadarnel27's already been there) like one.
    – Tim Stone
    Jul 22, 2012 at 1:03
  • You made quick work of that! Can't wait to see it on the site (in some mysterious version) =D Jul 23, 2012 at 3:37
  • Minor suggestion: Change the button text from "Cancel" to "Oh $%^&" (per Ben Brocka's comment) Jul 23, 2012 at 3:40
  • 1
    I've heard a rumour that it'll go out in the near future, pending a review (hopefully sometime this week) of the fairly large backlog of things I've added since the last pull to the main repository.
    – Tim Stone
    Jul 23, 2012 at 4:00
  • Really, Tim? "I can't believe I didn't think of it myself"? The question explicitly states "Tim Stone can't complain about this, because it was totally his idea" with a reference link and everything.
    – Pops
    Jul 23, 2012 at 21:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .