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: Friday, May 2, 2014 3:32 AM
Points: 53, Visits: 132
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: Tuesday, July 1, 2014 5:21 PM
Points: 958, Visits: 156
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: Today @ 8:19 AM
Points: 293, Visits: 813
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