Skip to content

Latest commit

 

History

History
70 lines (49 loc) · 2.04 KB

File metadata and controls

70 lines (49 loc) · 2.04 KB
title sp_droplogin (Transact-SQL)
description sp_droplogin removes a SQL Server login.
author markingmyname
ms.author maghan
ms.reviewer randolphwest
ms.date 06/23/2025
ms.service sql
ms.subservice system-objects
ms.topic reference
f1_keywords
sp_droplogin
sp_droplogin_TSQL
helpviewer_keywords
sp_droplogin
dev_langs
TSQL

sp_droplogin (Transact-SQL)

[!INCLUDE SQL Server]

Removes a [!INCLUDE ssNoVersion] login, which prevents access to an instance of [!INCLUDE ssNoVersion] under that login name.

Important

[!INCLUDE ssNoteDepFutureAvoid] Use DROP LOGIN instead.

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

Syntax

sp_droplogin [ @loginame = ] N'loginame'
[ ; ]

Arguments

[ @loginame = ] N'loginame'

The login to be removed. @loginame is sysname, with no default. @loginame must already exist in [!INCLUDE ssNoVersion].

Return code values

0 (success) or 1 (failure).

Remarks

sp_droplogin calls DROP LOGIN.

sp_droplogin can't be executed within a user-defined transaction.

Permissions

Requires ALTER ANY LOGIN permission on the server.

Examples

The following example uses DROP LOGIN to remove the login Victoria from an instance of [!INCLUDE ssNoVersion]. This method is preferred.

DROP LOGIN Victoria;
GO

Related content