title | description | author | ms.author | ms.date | ms.service | ms.subservice | ms.topic | ms.custom | f1_keywords | helpviewer_keywords | dev_langs | monikerRange | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
DROP USER (Transact-SQL) |
DROP USER (Transact-SQL) |
VanMSFT |
vanto |
05/12/2017 |
sql |
t-sql |
reference |
|
|
|
|
>=aps-pdw-2016 || =azuresqldb-current || =azure-sqldw-latest || >=sql-server-2016 || >=sql-server-linux-2017 || =azuresqldb-mi-current || =fabric |
[!INCLUDE SQL Server Azure SQL Database Azure SQL Managed Instance Azure Synapse Analytics PDW FabricSQLDB]
Removes a user from the current database.
:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: Transact-SQL syntax conventions
-- Syntax for SQL Server and Azure SQL Database
DROP USER [ IF EXISTS ] user_name
-- Syntax for Azure Synapse Analytics and Parallel Data Warehouse
DROP USER user_name
IF EXISTS
Applies to: [!INCLUDEssNoVersion] ( [!INCLUDEsssql16-md] through current version, [!INCLUDEsssds]).
Conditionally drops the user only if it already exists.
user_name
Specifies the name by which the user is identified inside this database.
Users that own securables cannot be dropped from the database. Before dropping a database user that owns securables, you must first drop or transfer ownership of those securables.
The guest user cannot be dropped, but guest user can be disabled by revoking its CONNECT permission by executing REVOKE CONNECT FROM GUEST within any database other than master or tempdb.
Caution
[!INCLUDEssCautionUserSchema]
Requires ALTER ANY USER permission on the database.
The following example removes database user AbolrousHazem
from the [!INCLUDE sssampledbobject-md] database.
DROP USER AbolrousHazem;
GO
CREATE USER (Transact-SQL)
ALTER USER (Transact-SQL)
EVENTDATA (Transact-SQL)