Share via

how to copy usermappings from one to another

drmrdba 0 Reputation points
2025-09-15T06:35:19.7766667+00:00

how to copy user mappings from one to another for sql server database 2017 EE

SQL Server Database Engine
0 comments No comments

Answer recommended by moderator

  1. Azar 31,715 Reputation points MVP Volunteer Moderator
    2025-09-15T17:23:23.6566667+00:00

    Hi there drmrdba

    Thanks for using QandA platform

    You can script out the user mappings from the existing login and apply them to another. In SSMS, right-click the login → Script Login as → CREATE To → New Query Editor Window — this generates the T-SQL with database mappings/roles. Modify the script for the target login and run it. Alternatively, query sys.database_role_members and sys.database_principals to list mappings, then use sp_addrolemember or ALTER ROLE ... ADD MEMBER to reapply them.

    If this helps kindly accept the answer thanks much.

    Was this answer helpful?


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.