I have been annoyed by having to change the database from the available databases drop-down whenever I want to write a query. This was because the default database which is always selected was the “Master” database which I never use.
If you had the same problem then this is the solution you’ve been waiting for!
It’s really easy simple type following command and run it!
Exec sp_defaultdb @loginame='login', @defdb='master'
Replace ‘login’ and ‘master’ with your login (user) name and the name of the database you prefer to have as default.
Following is my exmple:
Exec sp_defaultdb @loginame='menol', @defdb='rp2_test'
From now on whenever you open a new query window, the default database will be the database you selected!
(You will need to log-back in to see the change working.)