Closing an SSMS table data window with a running query does not cancel that query
- Use "Edit table" on a big table
- Edit the SQL to be an expensive query. For example, make it "select top 200 * from T order by UnindexedColumn". The query must run longer than the timeout (30s)
- Start the query
- Close the tab without waiting for the query to finish
Problem: The query continues running and consuming server resources. There is no way to cancel it. If you've made a mistake you just put extreme load on the server and can't undo that mistake. After 30s a message box pops up unexpectedly informing the user about the timeout errors.
I assume that if no timeout is configured the query would just run forever with no UI indication of this.
Solution: The query should be cancelled (SqlCommand.Cancel).