Have you ever been in a situation wherein you have been working furiously on your SQL Server Management Studio (SSMS) on multiple query windows and you need to rush out to a meeting? As you know, each query editor window within the SSMS opens a new connection to the SQL Server. Open connections mean more resources being consumed at the server. Hence, when going into a meeting or lunch, one may not want to keep these connections open. I don’t.
So, what do I do in such cases?
The answer is simple: I use the “Disconnect all queries” feature available in the SSMS query editor right-click context menu. Here’s a short demo.
As you can see in the screen-shot below, I have 4 queries open – each connected to a different SQL server instance (to cycle through the open queries, simply use the Ctrl+TAB keyboard shortcut).
Now, to disconnect all queries from the corresponding SQL Server instances in one go, right-click in the query editor window, go to Connections->Disconnect all queries.
Upon clicking “Disconnect all Queries”, notice that the tabbed document spaces for all queries are now reading “not connected”.
I personally don’t like to reopen the SSMS often – it’s launched once in the morning, and the only time I close it is when I shut down my laptop in the evening. Having a “disconnect all queries” is a cool little feature that comes in very handy.
Hope you like it as much as I do! Do you know of any cool features within SSMS? Do let me know!
Until we meet next time,