azuredatastudio
azuredatastudio copied to clipboard
Unable to change database context in the Query Editor after dropping a database
trafficstars
- Create a new database (e.g. ADSTest)
- Open a query editor, make sure the context is the ADSTest database.
- Create a table in the database (create table dbo.test (col1 int))
- Right-click on the database to drop it, select Close Existing Connections
- The database will be dropped successfully (yay!)
- Back in the query editor window, the database context still shows ADSTest.
- From the drop down, try to change the context. Message is: Failed to change database.
- It doesn't appear I'm able to change context with the USE statement either.
Version: 1.46.0-insider (user setup) Commit: d5a9c172d10dc49ef18b02455835cdba0b938a02 Date: 2023-08-22T18:08:21.002Z VS Code: 1.79.2 Electron: 22.3.14 Chromium: 108.0.5359.215 Node.js: 16.17.1 V8: 10.8.168.25-electron.0 OS: Windows_NT x64 10.0.22621
Dropping Connections is a SMO-level action, so I wonder if the same problem happens if you delete the database through SSMS and try to change the connection in ADS.
Yes, the same thing happens when deleting the database outside of ADS. So looks like this is more of a connection resiliency thing with the query editor.