sp_dropuser

Description

Drops a user from the current database.

Syntax

sp_dropuser name_in_db

Parameters

name_in_db

is the user’s name in the current database’s sysusers table.

Examples

Example 1

Drops the user “albert” from the current database. The user “albert” can no longer use the database:

sp_dropuser albert

Usage

Permissions

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

Granular permissions enabled

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

Granular permissions disabled

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

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

Commands grant, revoke, use

System procedures sp_addalias, sp_adduser, sp_bindexeclass, sp_droplogin