Is it possible to run a query to return the members of a database User group?

  • Is it possible to run a query to return the members of a database User group?

  • If you want to get members of database role you can use the fallowing query:

    select Users.name as UserName, Roles.name as RoleName

    from sys.database_role_members drm inner join sys.database_principals Users on drm.member_principal_id = Users.principal_id

    inner join sys.database_principals Roles on drm.role_principal_id = Roles.principal_id

    where Roles.type = 'R' and Users.type <> 'R'

    If you want to get the members of an active directory group members in order to see who can login to the server you can use the procedure xp_loginfo.

    Adi

    --------------------------------------------------------------
    To know how to ask questions and increase the chances of getting asnwers:
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    For better answers on performance questions, click on the following...
    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

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

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