August 26, 2010 at 10:01 pm
Comments posted to this topic are about the item Script Server Roles
August 29, 2010 at 5:30 pm
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
October 18, 2012 at 8:50 pm
Thank You!
--First Create sp_help_revlogin and use it to migrate logins
--Second run this to update the server roles
May 18, 2016 at 1:06 pm
Thanks for the script.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy