An invalid parameter or option was specified for procedure 'sys.sp_change_users_login'.
Today, we encountered a new issue that we had not seen before. When trying to update a database's logins after restoring it from prod, the usual stored procedure we run (sys.sp_change_users_login) didn't seem to function as we would expect.
EXEC sp_change_users_login 'Auto_Fix', 'YOURUSERNAMEHERE'
No matter what we did, that always resulted in the error message:
An invalid parameter or option was specified for procedure 'sys.sp_change_users_login'.
After a little head-scratching, we realized the issue was because the login didn't exist so it could be linked to the database user so although the user was in the database, the login was missing on the server.
It's not the greatest error message. It would be better if it said that the login was missing. Hopefully, this saves someone some time.
Liked this post? Got a suggestion? Leave a comment