Sometimes you need to create a new login from an existing login. For example, recently I helped one of my customers to move all the Windows logins to SQL Server logins as part of an overall architecture change. When you need to create a new login from an existing login, you need to address the following issues:
Login Properties
Server Role Memberships
Server Level Permissions
Related Database Users
Database Role Memberships
Database Level Permissions
This script takes care of everything. Once you put your values in @OldLoginName, @NewLoginName and @NewPassword, it will create a new SQL Server login with the requested name and password, and it will copy all the relevant data from the old login.
Comments