List Server Roles

  • I am currently working on a SSIS configuration database.  However, I am having trouble writing a script to get the the users that have each server role permissions.  I'm pretty sure that I need to use sp_helpsrvrole, but am not sure where to go from here.  If anybody has any ideas or has seen a script on the internet to get this then that would be a tremendous help.

    Thanks in advance,

    Kyle

  • Use sp_helpsrvrolemember.  What do you want to do with the list of logins once you get them?

    Greg

    Greg

  • The following query should get you what you want:

    select

    role.name,

    member.name

    from

    sys.server_role_members rm

    inner join

    sys.server_principals member

    on

    rm.member_principal_id = member.principal_id

    inner join

    sys.server_principals role

    on

    rm.role_principal_id = role.principal_id

    HTH,

    Ben

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply