SELECT Username = U.name ,Roles = STRING_AGG(r.name, ',') FROM sys.database_role_members AS DRM inner join sys.database_principals AS r ON DRM.role_principal_id = r.principal_id and r.type = 'R' inner join sys.database_principals AS U ON DRM.member_principal_id = U.principal_id group by u.name ORDER BY u.name