Thursday, March 22, 2012

Duplicate an existing SQL Login Account

How does one create a copy of an existing SQL login account. I have a
database that has a single login with everything setup. I just want to be
able to copy/duplicate the existing account to a new user so I can set a
different
password.
Thanks!You might be able to get what you want by "Generating SQL Script" from
the right-click context menu on the database you want to add the user
to. Place the checkmarks on the first tab to create all types of
objects, uncheck the options to create the CREATE and DROP statements on
the second tab, and go to the 3rd tab and check "Script object-level
permissions".
When you build the script, it should include commands that grant the
permissions to the current account that holds the permissions. You will
have to manually pick through the script commands to find the
appropriate ones and change the name of the user to replace the old
user's username with the new one to build an entirely new script.
While not the answer you're looking for, I think you should consider
creating one or more roles configured to grant permissions that match
the account that is configured properly now, then create the new account
and add the both user accounts to the role you created.
Good luck,
Tony Sebion
"John Williams" <JohnWilliams@.discussions.microsoft.com> wrote in
message news:F0AEB5FA-2AFD-4785-9217-184B22E3CFE0@.microsoft.com:
> How does one create a copy of an existing SQL login account. I have a
> database that has a single login with everything setup. I just want to be
> able to copy/duplicate the existing account to a new user so I can set a
> different
> password.
> Thanks!|||Scripting it out will work, the only downside would be remebering to
propogate all changes from user to user as things change. And things
always do change...
I'd recommend setting the permissions that are on user account to a
role instead. Then you can assign the role to the users that need
those permissions.
If needed you can deny access to objects on a user by user basis if
necessary or create another role that has those denied permissions and
assign that to the users.
HTH
Jason Strate

No comments:

Post a Comment