sp_addalias

Description

Allows an Adaptive Server user to be known in a database as another user.

Syntax

sp_addalias loginame, name_in_db

Parameters

loginame

is the master.dbo.syslogins name of the user who wants an alternate identity in the current database.

name_in_db

is the database user name to alias loginame to. The name must exist in both master.dbo.syslogins and in the sysusers table of the current database.

Examples

Example 1

There is a user named “albert” in the database’s sysusers table and a login for a user named “victoria” in master.dbo.syslogins. This command allows “victoria” to use the current database by assuming the name “albert”:

sp_addalias victoria, albert

Usage

Permissions

Only the Database Owner, a System Administrator, or a System Security Officer can execute sp_addalias.

Auditing

Values in event and extrainfo columns from the sysaudits table are:

Event

Audit option

Command or access audited

Information in extrainfo

38

exec_procedure

Execution of a procedure

  • Roles – Current active roles

  • Keywords or options – NULL

  • Previous value – NULL

  • Current value – NULL

  • Other information – All input parameters

  • Proxy information – Original login name, if set proxy in effect

See also

Command use

System procedures sp_addlogin, sp_adduser, sp_dropalias, sp_helpuser