SQL Server - Error 15023: User already exists in current database

Alright, cause this troubles me regularly when restoring databases... ;-) If you ever encounter Error 15023: User already exists in current database you need to use sp_change_users_login to map an existing database user to a SQL Server login.

sp_change_users_login [ @Action = ] 'action'     [ , [ @UserNamePattern = ] 'user' ]      [ , [ @LoginName = ] 'login' ]          [ , [ @Password = ] 'password' ]

HTHs

Daniel