Delete Statement

The DELETE statement deletes selected entries. The basic delete statement has 4 clauses:


The WHERE clause is optional; if missing, all the entries within the container will be returned depending upon the query scope. The QUERY SCOPE is new for ldap query, if missing the default is subtree scope and will return all the subentries (you can change the default from the radio buttons at the bottom of sql editor)

Delete statement has the following general format


DELETE FROM Entry [WHERE predicate]


To delete all the entries within an entry (including entry and all its subentries) you type sql statement as:


This sql will delete all the entries in the cn=testuser,DC=LDAPSOFT,DC=COMcontainer as the default scope is subtree scope,  the above delete statement is same as :

DELETE FROM cn=testuser,DC=LDAPSOFT,DC=COM subtreescope


To delete only the immediate children you type sql statement as:

DELETE FROM cn=testuser,DC=LDAPSOFT,DC=COM onelevelscope


To delete the the entry only, type sql statement as:

DELETE FROM cn=testuser,DC=LDAPSOFT,DC=COM basescope


Note:  You don't have to provide the scope (subtreescope ,onelevelscope or basescope) in the sql statement. You can select it from the radio button at the bottom of the editor window




If the sql statement contains the scope it will take precedence over the scope selected using the radio buttons


You can also generate the simple type of sql delete statement from the popup menu



Delete Statement Confirmation Dialog


When you execute a delete statement a status dialog appears which provides you with the following information


The Delete Status dialog also gives you the ability to skip all errors or abort the operation after an error.



Note: For entries with subentries you will get error similar to following

Error: Not Allowed On Non-leaf - Unable to delete cn=testuser,DC=LDAPSOFT,DC=COM

If you really want to delete the entries with subentries, try running the delete statement with subtreescope and skip all errors for a few time. It will eventually delete the entry, because it will delete the leaf entries in every iteration.


Select statement

Update statement

Insert statement

Delete statement examples



Ldapsoft Home page Ldap plus AD Help Desk Professional Tool Home Page