Queries to get Security Information

  • Hello Everybody, I am looking out for queries to get following information

    1. To get all the members associated with a Role

    2. Removing objects from a schema say 'xyz' and assigning to dbo schema

  • sqlnaive (7/20/2011)


    Hello Everybody, I am looking out for queries to get following information

    1. To get all the members associated with a Role

    SELECT roles.name AS role_name,

    members.name AS member_name

    FROM sys.database_role_members rm

    JOIN sys.database_principals roles

    ON rm.role_principal_id = roles.principal_id

    JOIN sys.database_principals members

    ON rm.member_principal_id = members.principal_id

    WHERE roles.name = 'some_name' ;

    2. Removing objects from a schema say 'xyz' and assigning to dbo schema

    ALTER SCHEMA dbo TRANSFER xyz.table_name ;

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

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

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