Adds a new user to the current database.
sp_adduser loginame [, name_in_db [, grpname]]
sp_adduser margaret
sp_adduser haroldq, harold, fort_mudge
The database owner executes sp_adduser to add a user name to the sysusers table of the current database, enabling the user to access the current database under his or her own name.
Specifying a name_in_db parameter gives the new user a name in the database that is different from his or her login name in SAP ASE. The ability to assign a user a different name is provided as a convenience. It is not an alias, as provided by sp_addalias, since it is not mapped to the identity and privileges of another user.
A user and a group cannot have the same name.
A user can be a member of only one group other than the default group, “public”. Every user is a member of the default group, “public”. Use sp_changegroup to change a user’s group.
In order to access a database, a user must either be listed in sysusers (with sp_adduser) or mapped to another user in sysalternates (with sp_addalias), or there must be a “guest” entry in sysusers.
See also grant, revoke, use in Reference Manual: Commands.
The permission checks for sp_adduser differ based on your granular permissions settings.
Setting | Description |
---|---|
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. |
Values in event and extrainfo columns from the sysaudits table are:
Information | Values |
---|---|
Event | 38 |
Audit option | exec_procedure |
Command or access audited | Execution of a procedure |
Information in extrainfo |
|