SQL Server Indonesia User Groups Community Update database user name to another login name - Baby SQL ... (^.^)
Welcome to SQL Server User Group Indonesia
Sign in JoinHelp | Sign In Live ID

Update database user name to another login name

Why?

Error: 18456, followed by
Error: Login failed for user 'username'. Reason: Failed to open the explicitly specified database.

and then you find out that in your database, there is a user name that has no login name

How to fix it?

you can use sp_change_users_login to update database user name to another login name and usually used to fix orphaned user name (user name without login name), but only for SQL Server login and this is executed on database level.

sp_change_users_login ‘Report’ : search all user names that have no login name
sp_change_users_login ‘update_one’, ‘user name’, ‘login name’ : update the user name.

if you want to update orphaned user name for windows login name, you can drop the orphaned user name in your database, create the login name and then add it to your database again. (^.^)v

Published Thursday, September 25, 2008 10:29 AM by David
Filed under: , ,

Comments

No Comments