In SQL Server 2005 how to determine the role memberships and the permissions associated with login yy?

Solution:

Open the Query Editor by Connecting to the appropriate instance of SQL Server 2005. Execute the following statements under the context of ‘master’ database:

select suser_name(role_principal_id), suser_name(member_principal_id) from sys.server_role_members where member_principal_id = suser_id(‘xyz’)
select permission_name, class_desc, major_id from sys.server_permissions where grantee_principal_id = suser_id(‘xyz’)

To check the context of login:

select suser_name()

To check information on who owns the database :

select name, suser_sname(owner_sid) from sys.databases

or

SP_HELPDB

]]>

Leave a comment

Your email address will not be published.