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

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

  • Comments 4

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

Leave a Comment
  • Please add 4 and 3 and type the answer here:
  • Post
  • ja ja, immer wieder, nicht wahr? Bin dazu übergegangen, den Haupt-Benutzer in allen Custumer-DBs mit fixer SID anzulegen...

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

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

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

Page 1 of 1 (4 items)