Udostępnij za pośrednictwem


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

Comments

  • Anonymous
    November 03, 2007
    The comment has been removed

  • Anonymous
    April 10, 2008
    Well, to be honest that’s actually quite easy, nevertheless I keep forgetting it all the time (pretty

  • Anonymous
    June 24, 2012
    What am I supposed to give in single quote for action - should I change it with some name or leave it as it is?

  • Anonymous
    January 30, 2013
    never use sql before and trying to learn it. Would have preferred a more detailed example of this example. :(