Deleted user default database - SQL Server 2008

Posted by RadiantHex on Server Fault See other posts from Server Fault or by RadiantHex
Published on 2011-01-14T11:52:03Z Indexed on 2011/01/14 12:54 UTC
Read the original article Hit count: 427

Hi folks,

I cannot connect to the database anymore, I'm getting:

Cannot open user default database. Login failed.

I have deleted the database during a previous session and then tried to recreate it. But the recreate failed.

Now I am stuck with this error, what can I do?

Edit: I'm using Windows Authentication

Any ideas?

Fixed:

use the command:

sqlcmd -E -d master

then type:

ALTER LOGIN [Your Windows Login] WITH DEFAULT_DATABASE=master

GO

:)

© Server Fault or respective owner

Related posts about Windows

Related posts about windows-server-2008