Attempting to deprecate the procedure sp_change_users_login
as recommended by MS. I tried using:
ALTER USER UserName WITH LOGIN = UserName
as demonstrated here. This results in the error
Msg 15401, Level 16, State 2, Line 3458
Windows NT user or group 'UserName' not found. Check the name again.
UserName is both the user and the SQL login. Surely I am missing something simple but I cannot see what it is.
I had 3 names that failed and one does not have a login, but the other 2 do have logins. I can see the login and users in the Object Explorer. However if I open the login properties the user is not assigned to the target database. If I manually check the db box it works, but the point is that I am trying to clear up any orphaned users in my target database using SQL.