SQL Server Error: 15023

When we are restoring a database in a different SQL Server instance, it could happen that there is a Login with the same name of an existing user in the database.
This can lead to the next error:

User, group, or role 'user' already exists in the current database. (Microsoft SQL Server, Error: 15023)

Solve Error: 15023

To solve this error, we need to connect to the SQL Server instance and execute the following:

USE DATABASENAME
GO
ALTER USER "USER" WITH LOGIN = "USER"
GO

Make sure to replace DATABASENAME with your database name and USER with the name of the user.

Leave a Reply

Your email address will not be published. Required fields are marked *