MSSQL Error 15023: User already exists in current database.
Here’s another quick one.
An annoying thing that can happen with MSSQL Server, when you move a database to a new server by backing it up on one and then restoring it on the other, is that the server can tell you the username already exists, when you attempt to create it. It’s annoying.
The specific error is:
Error 15023: User already exists in current database.
ANyway, here’s how to fix it:
- 1. Open a new query.
- 2. Run the query: USE databasename
- 3. Run the query: EXEC sp_change_users_login ‘Report’ (this will show the users for the DB)
- 4. Run the query: EXEC sp_change_users_login ‘Auto_Fix’, ‘username‘, NULL, ‘password‘
This should clear the issue up.