Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
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: Tuesday, July 7, 2015 1:56 AM
Points: 53, Visits: 147
Comments posted to this topic are about the item Script Server Roles
Post #976118
Posted Sunday, August 29, 2010 5:30 PM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Tuesday, September 20, 2016 12:41 AM
Points: 1,221, Visits: 196
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


Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Friday, September 23, 2016 9:49 AM
Points: 537, Visits: 1,140
Thank You!

--First Create sp_help_revlogin and use it to migrate logins
--Second run this to update the server roles
Post #1374628
Posted Wednesday, May 18, 2016 1:06 PM
SSCrazy Eights

SSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy Eights

Group: General Forum Members
Last Login: Today @ 7:20 AM
Points: 8,084, Visits: 809
Thanks for the script.
Post #1787399
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse