SSMS – Prevent Open Tab from Querying DB After Disconnect

ssms

In SSMS if you have a tab open with a query and then you disconnect the database you can still run the query after disconnecting.

is there a way to prevent SSMS from running a query after server is disconnected?

disconnect

Best Answer

The Object Explorer pane and the Query pane are independent. You can have the Object Explorer connected without having a Query connected, and vice versa.

The menu option you probably want is Query -> Connection -> Disconnect.

HTH