Skip to content

Fix Orphaned Users

How to repair a single orphaned database user with sp_change_users_login Auto_Fix.

Published Mar 5, 2010

The quick one-user fix for the classic "user does not have a valid server login associated with this user" error. Run it in the affected database and let Auto_Fix re-map the database user to its matching login. The full form of the call also lets you specify the login name and password explicitly when the mapping is not one-to-one.

--EXEC sp_change_users_login 'Auto_Fix', 'user', 'login', 'password'

USE [<Database_Name>]
GO

EXEC sp_change_users_login 'Auto_Fix', '<User_Name>'
An unhandled error has occurred. Reload 🗙