Solved

Role of A user

Posted on 2011-02-16
7
474 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
Comment Utility
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
Comment Utility
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
Comment Utility
this means that sa is the SYSADMIN
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 40

Assisted Solution

by:Sharath
Sharath earned 500 total points
Comment Utility
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
Comment Utility
Hi Sharath,

The result is :
rolename      membername
sysadmin      sa

0
 
LVL 40

Expert Comment

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

Author Closing Comment

by:softbless
Comment Utility
thanks
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

SQL Server engine let you use a Windows account or a SQL Server account to connect to a SQL Server instance. This can be configured immediatly during the SQL Server installation or after in the Server Authentication section in the Server properties …
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

772 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

11 Experts available now in Live!

Get 1:1 Help Now