DROP LOGIN (Transact-SQL)DROP LOGIN (Transact-SQL)

适用对象: 是SQL Server 是Azure SQL 数据库 是Azure Synapse Analytics (SQL DW) 是并行数据仓库 APPLIES TO: yesSQL Server yesAzure SQL Database yesAzure Synapse Analytics (SQL DW) yesParallel Data Warehouse

删除 SQL ServerSQL Server 登录帐户。Removes a SQL ServerSQL Server login account.

主题链接图标 TRANSACT-SQL 语法约定Topic link icon Transact-SQL Syntax Conventions

语法Syntax

DROP LOGIN login_name  

参数Arguments

login_name login_name
指定要删除的登录名。Specifies the name of the login to be dropped.

RemarksRemarks

不能删除正在登录的登录名。A login cannot be dropped while it is logged in. 也不能删除拥有任何安全对象、服务器级对象或 SQL Server 代理作业的登录名。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. 有关详细信息,请参阅 孤立用户故障排除 (SQL Server)For more information, see Troubleshoot Orphaned Users (SQL Server).

SQL 数据库SQL Database中,对连接和服务器级别的防火墙规则进行身份验证时所需的登录数据会暂时缓存在每个数据库中。In SQL 数据库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. 若要强制刷新身份验证缓存并确保数据库具有最新版本的登录名表,请执行 DBCC FLUSHAUTHCACHE (Transact-SQL)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

要求对服务器拥有 ALTER ANY LOGIN 权限。Requires ALTER ANY LOGIN permission on the server.

示例Examples

A.A. 删除登录名Dropping a login

下列示例将删除登录名 WilliJoThe following example drops the login WilliJo.

DROP LOGIN WilliJo;  
GO 

另请参阅See Also

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