select name, RoleName FROM sys.sysmembers sm
JOIN
( select 'RoleName' = name, 'RoleId' = uid, 'IsAppRole' = isapprole
from sysusers where issqlrole = 1 or isapprole = 1 ) roles
ON sm.groupuid=roles.RoleID
JOIN
( select * from master.sys.sysusers where islogin=1 ) logins
ON logins.uid=sm.memberuid;
четвер, 29 жовтня 2009 р.
MSSQL: users and roles
How to get list of users with their roles?
Підписатися на:
Дописати коментарі (Atom)
The above mentioned code will give you the list of users with their roles. This code is easy to understand and learn. This code uses joins to perform the list operation. This can be directly used in your application.
ВідповістиВидалитиsap support packs