sp_addsrvrolemember (Transact-SQL)
Adds a login as a member of a fixed server role.
Transact-SQL Syntax Conventions
- [ @loginame = ] 'login'
-
Is the name of the login being added to the fixed server role. login is sysname, with no default. login can be a SQL Server login or a Windows login. If the Windows login has not already been granted access to SQL Server, access is automatically granted.
- [ @rolename = ] 'role'
-
Is the name of the fixed server role to which the login is being added. role is sysname, with a default of NULL, and must be one of the following values:
-
sysadmin
-
securityadmin
-
serveradmin
-
setupadmin
-
processadmin
-
diskadmin
-
dbcreator
-
bulkadmin
-
sysadmin
When a login is added to a fixed server role, the login gains the permissions associated with that role.
The role membership of the sa login and public cannot be changed.
Use sp_addrolemember to add a member to a fixed database or user-defined role.
sp_addsrvrolemember cannot be executed within a user-defined transaction.