The UPDATEREPLACE statement replace existing attribute value if the match is found. Ideally you may want to use this statement where attribute has multiple values and you want to replace one value. The basic UpdateReplace statement has 4 clauses:
The UPDATEREPLACE clause specifies the entry(ies) to update. The SET clause specifies the attributes to update. The WHERE clause specifies the condition. The WHERE clause is required and must contain the attribute value to replace with. 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). UPDATEREPLACE statement has the following general format
UPDATEREPLACE Entry SET set-list [WHERE predicate] [QuerryScope]
To replace an exiting value you write a statement as:
UPDATEREPLACE ou=testusers,o=stooges SET mail='newaddress@ldapsoft.com' where mail=oldaddress@ldapsoft.com'
This sql will update all the entries in the cn=testuser,DC=LDAPSOFT,DC=COM container as the default scope is subtree scope, the above update statement is same as :
UPDATEREPLACE ou=testusers,o=stooges SET mail='newaddress@ldapsoft.com' where mail=oldaddress@ldapsoft.com' subtreescope
To replace values of immediate children you type sql statement as:
UPDATEREPLACE cn=testuser,DC=LDAPSOFT,DC=COM SET mail='newaddress@ldapsoft.com' where mail=oldaddress@ldapsoft.com' onelevelscope
To replace values of the entry only you type sql statement as:
UPDATEREPLACE cn=testuser,DC=LDAPSOFT,DC=COM SET mail='newaddress@ldapsoft.com' where mail=oldaddress@ldapsoft.com' basescope
Before and after snapshot after running the following UPDATEREPLACE statement:
UPDATEREPLACE cn=testuser1,ou=testusers,o=stooges SET description ='description3' where description ='description2'

Related Links:
Difference b/w Update, UpdateAll and UpdateReplace
| AD Admin & Reporting Tool Home Page | |