Locks an Adaptive Server account so that the user cannot log in or displays a list of all locked accounts.
sp_locklogin [loginame, "{lock | unlock}"]
is the name of the account to be locked or unlocked.
specifies whether to lock or unlock the account.
Locks the login account for the user “charles”:
sp_locklogin charles, "lock"
Displays a list of all locked accounts:
sp_locklogin
Locking an Adaptive Server login account prevents that user from logging in. Use sp_locklogin instead of sp_droplogin for the following reasons:
You cannot drop a login who is a user in any database, and you cannot drop a user from a database if the user owns any objects in that database or has granted any permissions on objects to other users.
Adaptive Server may reuse the dropped login account’s server user ID (suid) when the next login account is created. This occurs only when the dropped login holds the highest suid in syslogins; however, it could compromise accountability if execution of sp_droplogin is not being audited. In addition, it is possible that the user with the reused suid will actually be able to access database objects that were authorized for the old suid.
You cannot drop the last remaining System Security Officer’s or System Administrator’s login account.
sp_locklogin with no parameters returns a list of all the locked accounts.
You can lock an account that is currently logged in. The user receives a warning that his or her account has been locked, but is not locked out of the account until he or she logs out.
A locked account can be specified as a Database Owner and can own objects in any database.
Locking an account that is already locked or unlocking an unlocked account has no effect.
When locking a System Security Officer’s login account, sp_locklogin verifies that at least one other unlocked System Security Officer’s account exists. Similarly, sp_locklogin verifies that there is always an unlocked System Administrator’s account. An attempt to lock the last remaining unlocked System Administrator or System Security Officer account causes sp_locklogin to return an error message and fail.
Only a System Administrator or a System Security Officers can execute sp_locklogin.
System procedures sp_addlogin, sp_droplogin, sp_modifylogin, sp_password