Skip to content

Latest commit

 

History

History
65 lines (50 loc) · 2.49 KB

File metadata and controls

65 lines (50 loc) · 2.49 KB
title DROP LOGIN (Transact-SQL)
description DROP LOGIN (Transact-SQL)
author VanMSFT
ms.author vanto
ms.date 05/11/2017
ms.service sql
ms.subservice t-sql
ms.topic reference
f1_keywords
DROP LOGIN
DROP_LOGIN_TSQL
helpviewer_keywords
deleting login accounts
logins [SQL Server], removing
DROP LOGIN statement
removing login accounts
dropping login accounts
dev_langs
TSQL
monikerRange >=aps-pdw-2016||=azuresqldb-current||=azure-sqldw-latest||>=sql-server-2016||>=sql-server-linux-2017||=azuresqldb-mi-current

DROP LOGIN (Transact-SQL)

[!INCLUDE sql-asdb-asdbmi-asa-pdw]

Removes a [!INCLUDEssNoVersion] login account.

:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: Transact-SQL syntax conventions

Syntax

DROP LOGIN login_name  

Arguments

login_name
Specifies the name of the login to be dropped.

Remarks

A login cannot be dropped while it is logged in. A login that owns any securable, server-level object, or SQL Server Agent job cannot be dropped.

You can drop a login to which database users are mapped; however, this will create orphaned users. For more information, see Troubleshoot Orphaned Users (SQL Server).

In [!INCLUDEssSDS], login data required to authenticate a connection and server-level firewall rules are temporarily cached in each database. This cache is periodically refreshed. To force a refresh of the authentication cache and make sure that a database has the latest version of the logins table, execute DBCC FLUSHAUTHCACHE (Transact-SQL).

Permissions

Requires ALTER ANY LOGIN permission on the server.

Examples

A. Dropping a login

The following example drops the login WilliJo.

DROP LOGIN WilliJo;  
GO 

See Also

CREATE LOGIN (Transact-SQL)
ALTER LOGIN (Transact-SQL)
EVENTDATA (Transact-SQL)