| title | DROP SERVER ROLE (Transact-SQL) | ||
|---|---|---|---|
| description | DROP SERVER ROLE removes a user-defined server role. | ||
| author | VanMSFT | ||
| ms.author | vanto | ||
| ms.reviewer | randolphwest | ||
| ms.date | 12/15/2025 | ||
| ms.service | sql | ||
| ms.subservice | t-sql | ||
| ms.topic | reference | ||
| f1_keywords |
|
||
| helpviewer_keywords |
|
||
| dev_langs |
|
||
| monikerRange | >=aps-pdw-2016 || >=sql-server-2016 || >=sql-server-linux-2017 || =azuresqldb-mi-current |
[!INCLUDE sql-asdbmi-asa-pdw]
Removes a user-defined server role.
User-defined server roles were introduced in [!INCLUDE ssSQL11].
:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: Transact-SQL syntax conventions
DROP SERVER ROLE role_name
[ ; ]
Specifies the user-defined server role to be dropped from the server.
User-defined server roles that own securables can't be dropped from the server. To drop a user-defined server role that owns securables, you must first transfer ownership of those securables or delete them.
User-defined server roles that have members can't be dropped. To drop a user-defined server role that has members, you must first remove members of the role by using ALTER SERVER ROLE.
Fixed server roles can't be removed.
You can view information about role membership by querying the sys.server_role_members catalog view.
Requires CONTROL permission on the server role or ALTER ANY SERVER ROLE permission.
The following example drops the server role purchasing.
DROP SERVER ROLE purchasing;
GOTo view role membership, use the Server Role (Members) page in [!INCLUDE ssManStudioFull], or execute the following query:
SELECT SRM.role_principal_id,
SP.name AS Role_Name,
SRM.member_principal_id,
SP2.name AS Member_Name
FROM sys.server_role_members AS SRM
INNER JOIN sys.server_principals AS SP
ON SRM.Role_principal_id = SP.principal_id
INNER JOIN sys.server_principals AS SP2
ON SRM.member_principal_id = SP2.principal_id
ORDER BY SP.name, SP2.name;To determine whether a server role owns another server role, execute the following query:
SELECT SP1.name AS RoleOwner,
SP2.name AS Server_Role
FROM sys.server_principals AS SP1
INNER JOIN sys.server_principals AS SP2
ON SP1.principal_id = SP2.owning_principal_id
ORDER BY SP1.name;