Rediger

Del via


sp_droplogin (Transact-SQL)

Applies to: SQL Server

Removes a SQL Server login, which prevents access to an instance of SQL Server under that login name.

Important

This feature will be removed in a future version of SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature. Use DROP LOGIN instead.

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 SQL Server.

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 SQL Server. This method is preferred.

DROP LOGIN Victoria;
GO