RE: How to Determine if a user is a member of the System Admin role?
- From: stcheng@xxxxxxxxxxxxxxxxxxxx (Steven Cheng[MSFT])
- Date: Fri, 09 Jun 2006 02:56:19 GMT
Hello Brad,
As for a windows user account(or group) or a sqlserver account, before we
check if it is of sysadmin role (in the server instance), we should first
check if it's a server login(principal) on that server instance. For this,
we can use some T-SQL query to lookup all the principals of sysadmin role
in the master db. It'll be a bit different for SQL 2005 and SQL 2000:
============2005===========
select p1.Name as Role_name, p2.Name as Member_name from
sys.server_role_members r1 inner join sys.server_principals p1
on r1.Role_principal_id = p1.Principal_id
inner join sys.server_principals p2
on r1.Member_principal_id = p2.Principal_id
=========================
As you can see, we need to query multiple catalog views in sys schema.
While in SQL server 2000, we can diretly query the "syslogins" table in
master db, and this table contains a "sysadmin" column indicate whether the
certain principal is of sysadmin role.
==============2000==================
select * from syslogins
Hope this helps.
Regards,
Steven Cheng
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
.
- Follow-Ups:
- RE: How to Determine if a user is a member of the System Admin role?
- From: Steven Cheng[MSFT]
- RE: How to Determine if a user is a member of the System Admin role?
- Prev by Date: RE: Security settings for SSRS webservice access from SQLCLR
- Next by Date: Re: Security settings for SSRS webservice access from SQLCLR
- Previous by thread: Re: How to Determine if a user is a member of the System Admin role?
- Next by thread: RE: How to Determine if a user is a member of the System Admin role?
- Index(es):
Relevant Pages
|