Less Than Dot is a community of passionate IT professionals and enthusiasts dedicated to sharing technical knowledge, experience, and assistance. Inside you will find reference materials, interesting technical discussions, and expert tips and commentary. Once you register for an account you will have immediate access to the forums and all past articles and commentaries.
Find Out Server Roles For a SQL Server Login
From Wiki
This is a quick way to find out what roles a user has on the SQL Server Just change the value of @chvLoginName to the login you want
- DECLARE @chvLoginName VARCHAR(50)
- SELECT @chvLoginName='BUILTIN\Administrators'
- SELECT [name],sysadmin,securityadmin,serveradmin,
- setupadmin,processadmin,diskadmin,
- dbcreator,bulkadmin,loginname
- FROM master..syslogins
- WHERE loginname =@chvLoginName
The query below returns all logins whose role is a certain role. The available roles are:
sysadmin
Can perform any activity in SQL Server.
serveradmin
Can set serverwide configuration options, shut down the server.
setupadmin
Can manage linked servers and startup procedures.
securityadmin
Can manage logins and CREATE DATABASE permissions, also read error logs and change passwords.
processadmin
Can manage processes running in SQL Server.
dbcreator
Can create, alter, and drop databases.
diskadmin
Can manage disk files.
bulkadmin
Can execute BULK INSERT statements.
- SELECT [name],sysadmin,bulkadmin
- FROM master..syslogins
- WHERE sysadmin =1 or bulkadmin =1
Contributed by: --SQLDenis 17:14, 7 June 2008 (GMT)
Part of SQL Server Admin Hacks



LTD Social Sitings
Note: Watch for social icons on posts by your favorite authors to follow their postings on these and other social sites.