Often when you restore a backup from SQL server you run into funky
problems with users. Suppose you have login calvin and you restore a
database from another server that already has user called calvin. When
you try to map the server calvin to the database calvin, you might
get the error:
Error 15023: User or role ‘calvin’ already exists in the current database.
To fix this, run either one of the following in the target database:
sp_change_users_login ‘Auto_Fix’, ‘my_user_name’
sp_change_users_login ‘update_one’, ‘calvin’, ‘calvin’, ‘password’
— this command will link the server user to the database level user.