Solved

Role of A user

Posted on 2011-02-16
7
480 Views
Last Modified: 2012-06-27
Hi Guys,

In my SQL Server, i have Wilson as user. I need to know what is his role.

Could we have SQL syntax to check what role is wilson. Specifically I wanna know whether Wilson has role Sysadmin or not.

Thanks.
0
Comment
Question by:softbless
  • 3
  • 3
7 Comments
 
LVL 40

Accepted Solution

by:
Sharath earned 500 total points
ID: 34913670
Can you check this?
SELECT 
 SSP.name AS [Login Name],
 SSP.type_desc AS [Login Type],
 UPPER(SSPS.name) AS [Server Role]
FROM sys.server_principals SSP 
INNER JOIN sys.server_role_members SSRM
ON SSP.principal_id=SSRM.member_principal_id 
INNER JOIN sys.server_principals SSPS 
ON SSRM.role_principal_id = SSPS.principal_id

Open in new window

0
 

Author Comment

by:softbless
ID: 34913693
Hi Sharath,

Thanks for the fast response.

Your query return 1 row :
sa      SQL_LOGIN      SYSADMIN

Does it mean that 'Wilson' is not SYSADMIN?
0
 

Expert Comment

by:donjuan_phd
ID: 34913709
this means that sa is the SYSADMIN
0
Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

 
LVL 40

Assisted Solution

by:Sharath
Sharath earned 500 total points
ID: 34913740
Do you have Wilson under Security -> Logins folder? Can you run this query also and see the result?
select rolename = rolep.name, membername= memp.name from sys.server_role_members rm
join sys.server_principals rolep on rm.role_principal_id = rolep.principal_id
join sys.server_principals memp on rm.member_principal_id = memp.principal_id

Open in new window

0
 

Author Comment

by:softbless
ID: 34913783
Hi Sharath,

The result is :
rolename      membername
sysadmin      sa

0
 
LVL 40

Expert Comment

by:Sharath
ID: 34913790
Can you check if Wilson is available under Security -> Logins?
0
 

Author Closing Comment

by:softbless
ID: 34976880
thanks
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In SQL Server, when rows are selected from a table, does it retrieve data in the order in which it is inserted?  Many believe this is the case. Let us try to examine for ourselves with an example. To get started, use the following script, wh…
Naughty Me. While I was changing the database name from DB1 to DB_PROD1 (yep it's not real database name ^v^), I changed the database name and notified my application fellows that I did it. They turn on the application, and everything is working. A …
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now