Skip to content

Latest commit

 

History

History
84 lines (63 loc) · 2.97 KB

File metadata and controls

84 lines (63 loc) · 2.97 KB
title DROP LOGIN (Transact-SQL) | Microsoft Docs
ms.custom
ms.date 11/16/2015
ms.prod sql-non-specified
ms.reviewer
ms.suite
ms.technology
database-engine
ms.tgt_pltfrm
ms.topic language-reference
f1_keywords
DROP LOGIN
DROP_LOGIN_TSQL
dev_langs
TSQL
helpviewer_keywords
deleting login accounts
logins [SQL Server], removing
DROP LOGIN statement
removing login accounts
dropping login accounts
ms.assetid acb5c3dc-7aa2-49f6-9330-573227ba9b1a
caps.latest.revision 36
author BYHAM
ms.author rickbyh
manager jhubbard

DROP LOGIN (Transact-SQL)

[!INCLUDEtsql-appliesto-ss2008-all_md]

Removes a [!INCLUDEssNoVersion] login account.

Topic link icon Transact-SQL Syntax Conventions

Syntax

-- Syntax for SQL Server, Azure SQL Database, Azure SQL Data Warehouse, Parallel Data Warehouse  
  
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    

Examples: [!INCLUDEssSDWfull] and [!INCLUDEssPDW]

B. Dropping a login

The following example removes database login login7 from the appliance.

DROP LOGIN login7;  

See Also

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