Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I use SQL Server Management Studio to log in to databases, it ignores my default DB and always puts me in master. I checked that my Windows user has a login with the correct DB set, and I tried changing the default DB of groups that I'm in without any effect. At login, I tried going to Connection Properties and setting "Connect to Database" to <default>, but it always gets reset to master. If I run Management Studio as a different Windows user, it applies default DB correctly.

Any ideas?

share|improve this question
    
There may be something wrong with SQL Server Management Studio and you could reinstall it. – ahmed Jan 4 '12 at 22:02

Change the default database of your database user. I suspect that group permissions are snarling you up. You can use the sp_defaultdb stored procedure.

Exec sp_defaultdb @loginame='login', @defdb='database'

Or you could use this bit of SQL:

ALTER LOGIN  [DOMAIN\login] 
WITH DEFAULT_DATABASE = master
share|improve this answer
    
Thanks, but that didn't work. Default database was already showing up correctly for the Login. – RossFabricant Jan 4 '12 at 20:15
up vote 0 down vote accepted

It was just an issue with one account, so I now run Management Studio through a different account, using a BAT file with the following:

runas /profile /savecred /user:DOMAIN-NT\service-account "C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\Ssms.exe"
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .