Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Script Server Roles Expand / Collapse
Author
Message
Posted Thursday, August 26, 2010 10:01 PM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Wednesday, September 10, 2014 12:46 AM
Points: 53, Visits: 138
Comments posted to this topic are about the item Script Server Roles
Post #976118
Posted Sunday, August 29, 2010 5:30 PM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Sunday, November 16, 2014 11:41 PM
Points: 999, Visits: 164
Hi Rasmus,

it is possibly to simplify your script up to one select statement :

SELECT 'EXEC sp_addsrvrolemember '''+pr.name+''', '''+pm.name+''''
FROM sys.server_role_members AS rm
JOIN sys.server_principals AS pm ON rm.role_principal_id=pm.principal_id
JOIN sys.server_principals AS pr ON rm.member_principal_id=pr.principal_id
WHERE pr.name <> 'sa'
AND pr.name NOT LIKE 'NT SERVICE%'
AND pr.name NOT LIKE 'NT AUTHORITY%'

Kind regards,
Andrei
Post #977128
Posted Thursday, October 18, 2012 8:50 PM


SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Saturday, November 22, 2014 6:10 PM
Points: 293, Visits: 821
Thank You!

--First Create sp_help_revlogin and use it to migrate logins
--Second run this to update the server roles
Post #1374628
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse