Link to home
Create AccountLog in
Avatar of 25112
25112

asked on

error 4064

for some users, the connection in SSMS fails:

Cannot open user default database. Login failed.
 Login failed for user ‘UserName’. (Microsoft SQL Server, Error: 4064)

why does not the connection like 'default' chosen? and this happens only for some users? why?

this user has permission to the database in question and that database has a proper owner. (no NULL)

when the user chooses a different database as default, then the connection goes through. but it is a pain to change everytime trying to connect SSMS.
ASKER CERTIFIED SOLUTION
Avatar of Tony303
Tony303
Flag of New Zealand image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
I have this code saved and run it everytime I have to pull back a copy of our Production database and restore it on top of a DEV or STG instance on a different server.
You may want to consider resetting all your SID's in all environments to be the same, that way they are always in sync.