sp_dropalias

Transact-SQL Reference

Transact-SQL Reference

sp_dropalias

Removes an alias to a user in the current database from a login. sp_dropalias is provided for backward compatibility only. Use roles and the sp_droprolemember stored procedure instead of aliases.

Syntax

sp_dropalias [ @loginame = ] 'login'

Arguments

[@loginame =] 'login'

Is the name of the Microsoft® SQL Server™ login or Microsoft Windows NT® user or group from which the alias is to be removed. login is sysname, with no default. login must already exist.

Return Code Values

0 (success) or 1 (failure)

Remarks

Aliases allow logins to assume the identity of a user in a database, thereby gaining the permissions of that user while working in that database.

When the alias is removed, the login can no longer perform the activities associated with the user to whom they were aliased in the current database.

sp_dropalias cannot be executed within a user-defined transaction.

Permissions

Only members of the sysadmin fixed server role, the db_accessadmin and db_owner fixed database roles can execute sp_dropalias.

Examples

This example removes the alias to user Victoria in the current database.

EXEC sp_dropalias 'Victoria'

See Also

sp_addalias

sp_addrolemember

sp_droprolemember

System Stored Procedures