selectstarfromyogi

sql server DBA ,sql server 2008 , 2012 , 2014 ,sql

Menu
Search
Skip to content
  • Home
  • About

server roles

List out the server roles of an user – TSQL

SET NOCOUNT ON;

DECLARE @Login sysname;

SET @Login = ‘login_name’;

SELECT R.name AS ‘Server Roles’
FROM sys.server_role_members AS RM
JOIN sys.server_principals AS L
ON RM.member_principal_id = L.principal_id
JOIN sys.server_principals AS R
ON RM.role_principal_id = R.principal_id
WHERE L.name = @Login;

April 27, 2015yogigollapudi server roles Leave a comment

Categories

  • DEVOps (1)
  • Errors (9)
  • FUN (1)
  • Performance Tuning (11)
  • powershell (12)
  • T-SQL (43)
  • Uncategorized (154)

Blog Stats

  • 39,569 hits
Follow selectstarfromyogi on WordPress.com
Create a free website or blog at WordPress.com.
Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy
  • Subscribe Subscribed
    • selectstarfromyogi
    • Already have a WordPress.com account? Log in now.
    • selectstarfromyogi
    • Subscribe Subscribed
    • Sign up
    • Log in
    • Report this content
    • View site in Reader
    • Manage subscriptions
    • Collapse this bar
Design a site like this with WordPress.com
Get started