Wednesday, February 18, 2009

Login failure when default DB deleted

When the defauld DB of the user is deleted. We could not able to login to DB.

Error Message:
Cannot open user default database. Login failed.
Login failed for user 'xyz'. (Microsoft SQL Server, Error: 4064)

Solution:
Change the default DB.

USE [master]
GO
ALTER LOGIN [FAREAST\v-prcher]
WITH DEFAULT_DATABASE=[AnyOtherExistingDBName],
DEFAULT_LANGUAGE=[us_english]
GO

No comments:

Post a Comment

Managing SQL Role

Recently, we had a scenario, where we need a simple SQL Role which gets read access to bunch of views.  While it was easy to create the vie...