"GetRoleMembership" Stored Procedure

Description:

This stored procedure returns all of the users who are members of the specified portal security role. The input parameter is the RoleID.

Definition:
    
    CREATE PROCEDURE GetRoleMembership
    (
        @RoleID  int
    )
    AS

    SELECT  
        UserRoles.UserID,
        Name,
        Email

    FROM
        UserRoles
        
    INNER JOIN 
        Users On Users.UserID = UserRoles.UserID

    WHERE   
        UserRoles.RoleID = @RoleID
        
Database Tables Used:

UserRoles:  The UserRoles table provides a many-to-many connection between portal security roles (defined in the Roles table) and users (defined in the Users table). Using the UserRoles table, each user may belong to multiple roles and and each role may have multiple users as members.

The UserRoles table has no primary key.

Users:  Each record in the Users table is a unique user identity. The primary key in this table is the UserID identity field.