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: 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: Thursday, July 30, 2015 12:18 AM
Points: 1,111, Visits: 174
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


Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Tuesday, August 4, 2015 1:59 PM
Points: 301, Visits: 868
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