How to query a database users and their roles

Run this query:

select a.uid, a.name, b.groupuid, case when c.name is null then 'public' else c.name end as db_role from sysusers a left outer join sysmembers b on a.uid=b.memberuid left outer join sysusers c on b.groupuid=c.uidwhere a.status>0

No comments: