SQL Server error when creating user: 15023 User, group or role 'XXX' already exists in the current database?

In this case, there are orphaned users, a stored procedure sp_change_users_login of the system can be used to repair

Use woiitnet
go
sp_change_users_login 'update_one', 'woiitnet', 'woiitnet'

where "woiitnet" is the database name, update_one means to update only this one, 'woiitnet' ' The associated login and username are required.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326658778&siteId=291194637