Thursday, 15 April 2021

SQL Server Error User Group or Role Already Exists in the Current Database Error Number 15023

 Whenever user mapping done is doing in SQL Server there comes an error such as 




Microsoft SQL Server, Error: 15023

To resolve this connect to the sql server using system administrator account and give the below commands

use [database_name]  -- give the database name exec sp_change_users_login 'AUTO_FIX', '[login_name]' -- give the login name 
go

Now you can check the database access using the login given above.

If everything is OK you will see the following output:

The row for user  will be fixed by updating its login link to a login already in existence.The number of orphaned users fixed by updating users was 1.The number of orphaned users fixed by adding new logins and then updating users was 0.

 This saved my day!! Hope it helps you too...