Re-map user to login in SQL server after restoring or attaching database

Re-map database user to a login in SQL server after restoring or attaching database

When restoring or attaching a database to a new or different Microsoft SQL server the logins and mappings to the database users are lost. If you create the logins again you’re not able to map the users because they already exist in the database:

User, group, or role '{login}' already exists in the current database.

Continue reading