Update an attribute of all entries using where clause

Home | Tutorials | Compare


This tutorial explains how to update an attribute of all entries within a container using where clause. To run update statement first connect to the directory server (To create a new connection please see Connecting to a LDAP Server using LDAP Admin Tool)

After successful connection, select the SQL button from the top menu, this will open the sql tab where you can enter the sql statements. You can also create simple sql statement from the right click context menu (Bottom tree pane).


Query LDAP Using Select Statments


To create a simple sql statement to update all records within a container, Select entry and from right click context menu select 'Update this record and all Children)

Update LDAP Entries


Ctrl+v (or paste) to paste the data to the sql window modify the attribute to update, for e.g. to update postalcode to 60660 where mail attribute not equal to 'test@test.com' and sn not equal to 'test', modify the statement to

Update o=stooges set postalCode= '60660' where mail != 'test@test.com' and sn!='test'

Change the maximum results to number of records expected or '0' for unlimited. Click 'Run' to run the statement.


Update LDAP Entries using where clause


When you run the statement, A Status dialog will appear which provides the following information

Number of entries to be updated
Status of each entry (Whether the entry update was successful or not)
Total status (how many succeeded how many failed)

Verify the entries to update and click 'Yes'


Mass edit ldap entries


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


Mass edit entries

Warning: Don't run the update statement on attributes with multiple values as it will replace the attribute with new single value. For multiple value please use UpdateReplace statement (For syntax and more information please see the product documentation - search for 'updatereplace' and also 'Difference Between Update, UpdateAdd & Update Replace Statement')

See Also:
Query LDAP using Select Statements