sp_dropalias (Transact-SQL)

Removes an alias that links a user in the current database to a SQL Server login.

Important

sp_dropalias provides compatibility with earlier versions of SQL Server. This feature will be removed in a future version of Microsoft SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature. SQL Server provides roles and the ability to grant permissions to roles as an alternative to using aliases.

Topic link iconTransact-SQL Syntax Conventions

Syntax

sp_dropalias [ @loginame = ] 'login'

Arguments

  • [ @loginame = ] 'login'
    Is the name of the SQL Server login, Windows login, or Windows 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 enable 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 whose alias the login assumed in the current database.

sp_dropalias cannot be executed within a user-defined transaction.

Permissions

Requires membership in the db_owner fixed database role.

Examples

The following example removes the alias to SQL Server login Victoria from the current database.

EXEC sp_dropalias 'Victoria'

See Also

Reference

Security Stored Procedures (Transact-SQL)
sp_addalias (Transact-SQL)
sp_addrolemember (Transact-SQL)
sp_droprolemember (Transact-SQL)
System Stored Procedures (Transact-SQL)

Help and Information

Getting SQL Server 2005 Assistance