What is the correct way to fix orphan user:
sp_change_users_login @Action='update_one',
@UserNamePattern='TestUser1',
@LoginName='TestUser1'
Or
ALTER USER TestUser1 WITH LOGIN=TestUser1
Both fix the orphan user.
What is the correct way to fix orphan user:
sp_change_users_login @Action='update_one',
@UserNamePattern='TestUser1',
@LoginName='TestUser1'
Or
ALTER USER TestUser1 WITH LOGIN=TestUser1
Both fix the orphan user.
The documentation states about sp_change_users_login:
This feature will be removed in a future version of Microsoft SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature. Use ALTER USER instead.