Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Administration
 Clone Login

Author  Topic 

GoodEnuf
Starting Member

3 Posts

Posted - 2011-02-17 : 18:31:44
In SQL Server 2008, I would like to clone a login via T-SQL... this means taking an existing login with all of its properties and DB rights and create an identical login (with a different name and password). The use case is that I would do a minor tweak to the rights to suit the user.

How best to generate this script? I don't see any options in SSMS to create this script...

thx in advance!

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2011-02-18 : 06:37:15
right click the login - script login as - create to new query edit window
then change login name and password where you can see it
then execute the script


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

GoodEnuf
Starting Member

3 Posts

Posted - 2011-02-21 : 12:53:51
Thx for the response! However, that script only creates the login and the server roles, but does not generate any of the database user mappings or any specific database permissions that were set for the original login.

That's what I mean by 'cloning' a login; essentially create a duplicate login (except username/password) including all permissions etc.

Given all the database user and schema objects that would need to be considered, perhaps this is too much to ask. :(

Go to Top of Page
   

- Advertisement -