When I open SQL Server Management Studio, I have many databases listed there, If I open a database and open the list of its tables and right click on a table and say Select Top 1000 rows it correctly queries that table of that database BUT it also automatically picks TempDb as the database in the available database combobox in the toolbar like the picture below.

So now if I want to write a query by clicking on "New Query" it will look at "tempDB", which is annoying. Is there a way to change this behavior ?
You can select a default database per connection in SQL Server, which might help. Once you've set it, each time you connect to that server, the default database will be selected.


If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With