Solved

Role of A user

Posted on 2011-02-16
7
482 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
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

 
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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL Server 2012 rs - Sum each category by month 4 32
MS SQL Delete Query 9 33
Help Required 2 33
Text file into sql server 5 28
Data architecture is an important aspect in Software as a Service (SaaS) delivery model. This article is a study on the database of a single-tenant application that could be extended to support multiple tenants. The application is web-based develope…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

831 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