DROP LOGIN (Transact-SQL)
TOC
Collapse the table of content
Expand the table of content

DROP LOGIN (Transact-SQL)

 

Updated: November 16, 2015

THIS TOPIC APPLIES TO: yesSQL Server (starting with 2008)yesAzure SQL DatabaseyesAzure SQL Data Warehouse yesParallel Data Warehouse

Removes a SQL Server login account.

Topic link icon Transact-SQL Syntax Conventions

  
DROP LOGIN login_name  

-- Azure SQL Data Warehouse and Parallel Data Warehouse  
DROP LOGIN login_name  
[;]  

login_name
Specifies the name of the login to be dropped.

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 SQL Database, 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).

Requires ALTER ANY LOGIN permission on the server.

A. Dropping a login

The following example drops the login WilliJo.

DROP LOGIN WilliJo;  
GO    

B. Dropping a login

The following example removes database login login7 from the appliance.

DROP LOGIN login7;  

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

Community Additions

ADD
Show:
© 2016 Microsoft