Removes the alias user name identity established with sp_addalias.
sp_dropalias loginame [, force]
sp_dropalias victoria
sp_dropalias harry, force Warning: You have forced the drop of the alias for login 'harry' which owns objects in the database. This may result in errors when those objects are accessed from or contain references to another database. Alias user dropped.(return status = 0)
Executing the sp_dropalias procedure deletes an alternate suid mapping for a user from the sysalternates table.
When a user’s alias is dropped, he or she no longer has access to the database for which the alias was created.
You can drop the alias of a user who owns objects in the database. You do not need to first drop the objects before dropping the login.
The permission checks for sp_dropalias 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 sso_role, or a user with sa_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 |
|