Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change the default database in SQL Server Management Studio

Tags:

sql-server

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.

enter image description here

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 ?

like image 864
ConfusedSleepyDeveloper Avatar asked Jun 12 '26 07:06

ConfusedSleepyDeveloper


1 Answers

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.

enter image description here

enter image description here

like image 137
Tanner Avatar answered Jun 17 '26 22:06

Tanner