Drops an Adaptive Server user login by deleting the user’s entry from master.dbo.syslogins.
sp_droplogin loginame
is the name of the user, as listed in master.dbo.syslogins.
Drops the “victoria” login from Adaptive Server:
sp_droplogin victoria
If sp_cleanpwdchecks is present in the master database, it is executed after dropping a login with sp_droplogin.
Executing sp_droplogin drops a user login from Adaptive Server, deleting the user’s entry from master.dbo.syslogins.
Adaptive Server reuses a dropped login’s server user ID, which compromises accountability. You can avoid dropping accounts entirely and, instead, use sp_locklogin to lock any accounts that will no longer be used.
If you need to drop logins, be sure to audit these events (using sp_audit) so that you have a record of them.
sp_droplogin deletes all resource limits associated with the dropped login.
sp_droplogin fails if the login to be dropped is a user in any database on the server. Use sp_dropuser to drop the user from a database. You cannot drop a user from a database if that user owns any objects in the database.
Regardless, the login is dropped if the database is offline.
If the login to be dropped is a System Security Officer, sp_droplogin verifies that at least one other unlocked System Security Officer’s account exists. If not, sp_droplogin fails. Similarly, sp_droplogin ensures that there is always at least one unlocked System Administrator account.
When sp_droplogin is unable to drop a login due to the existence—in any databasee—of a user in sysusers referencing the login suid, the names of databases in which the references are found are now displayed in the error message. The error message looks similar to:
1> sp_droplogin probe 2> go Msg 19587, Level 16, State 1: Procedure 'sp_droplogin', Line 281: User exists or is an alias or is a database owner in 'master' 'sybsystemdb' database(s). (return status = 1)
Only a System Security Officer can execute sp_droplogin.
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 |
|
System procedures sp_addlogin, sp_audit, sp_cleanpwdchecks, sp_dropuser, sp_locklogin