SQL Server 2005查看数据库用户权限

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

use yourdb
go

select DbRole = g.name, MemberName = u.name, MemberSID = u.sid
  from sys.database_principals u, sys.database_principals g, sys.database_role_members m
 where g.principal_id = m.role_principal_id
   and u.principal_id = m.member_principal_id
 order by 1, 2
go