Caché SQL Reference
[Home] [Back] [Next]
InterSystems: The power behind what matters   
Class Reference   

Removes a user account.
DROP USER user-name
user-name The name of the user to be removed.
The DROP USER command removes a user account. This user account was created and the user-name specified using CREATE USER. If the specified user-name does not correspond to an existing user account, Caché issues an SQLCODE -118 error. User names are not case-sensitive.
You can also delete a user from the Management Portal. Select [Home] > [Security Management] > [Users] to list the existing users. On this table of user accounts you can click Delete for the user account you wish to delete.
The DROP USER command is a privileged operation. Prior to using DROP USER in embedded SQL, it is necessary to be logged in as a user with appropriate privileges. Failing to do so results in an SQLCODE -99 error (Privilege Violation).
Use the $SYSTEM.Security.Login() method to assign a user with appropriate privileges:
   DO $SYSTEM.Security.Login("_SYSTEM","SYS")
   &sql(      )
You must have the %Service_Login:Use privilege to invoke the $SYSTEM.Security.Login method. For further information, refer to %SYSTEM.Security in the InterSystems Class Reference.
You can drop PSMITH by issuing the statement:
DROP USER psmith
See Also