0

我尝试了以下方法,但我未能单独获得记录。任何我在这里缺少的线索。

SELECT users.name, groups.name
FROM sysmembers membs 
    JOIN sysusers users on membs.memberuid = users.uid 
    JOIN sysusers groups on membs.groupuid = groups.uid 
4

1 回答 1

1

是的,我知道了.......

SELECT members.name AS UserName, RTRIM(LTRIM(roles.name)) AS RoleName 
FROM sys.database_principals members 
  INNER JOIN sys.database_role_members drm 
    ON members.principal_id = drm.member_principal_id 
  INNER JOIN sys.database_principals roles 
    ON drm.role_principal_id = roles.principal_id 
WHERE members.name <> 'dbo'
ORDER BY members.name
于 2013-05-24T15:56:23.570 回答