sp_addalias

Allows an SAP ASE user to be known in a database as another user.

Syntax

sp_addalias loginame, name_in_db

Parameters

Examples

Usage

There are additional considerations when using sp_addalias:
  • Executing sp_addalias maps one user to another in the current database. The mapping is shown in sysalternates, where the two users’ suids (system user IDs) are connected.

  • A user can be aliased to only one database user at a time.

  • A report on any users mapped to a specified user can be generated with sp_helpuser, giving the specified user’s name as an argument.

  • When a user tries to use a database, the SAP ASE server checks sysusers to confirm that the user is listed there. If the user is not listed there, the SAP ASE server then checks sysalternates. If the user’s suid is listed in sysalternates, mapped to a database user’s suid, the SAP ASE server treats the first user as the second user while using the database.

    If the user named in loginame is in the database’s sysusers table, the SAP ASE server does not use the user’s alias identity, because it checks sysusers and finds the loginame before checking sysalternates, where the alias is listed.

See also use in Reference Manual: Commands.

Permissions

The permission checks for sp_addalias differ based on your granular permissions settings.

SettingDescription
Enabled

With granular permissions enabled, you must be a user with manage any user privilege.

Disabled

With granular permissions disabled, you must be the database owner, a user with sa_role, or a user with sso_role.

Auditing

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

InformationValues
Event

38

Audit option

exec_procedure

Command or access audited

Execution of a procedure

Information in extrainfo
  • 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

Related reference
sp_addlogin
sp_adduser
sp_dropalias
sp_helpuser