Update Statement Examples

 

Query

Results of Query

 

UPDATE uid=test555102test222,

uid=1062test444,cn=users,cn=test,cn=testuser,

DC= LDAPSOFT , DC =COM SET 

cn='test',

sn='test',

uid='test555102test222'

basescope

 

cn,sn and uid of the entry uid=test555102test222,uid=1062test444,

cn=users,cn=test,cn=testuser,DC= LDAPSOFT , DC =COM is updated

UPDATE DC= LDAPSOFT , DC =COMSET 

businesscategory='services'

onelevelscope

businesscategory attribute of all the immediate children of DC= LDAPSOFT , DC =COM is updated

UPDATE DC= LDAPSOFT , DC =COMSET 

businesscategory='services'

subtreescope

 

businesscategory attribute of all the subentries within DC= LDAPSOFT , DC =COM is updated

 

More Update Statement Examples (Multiple Values) (Version 3.2 onwards)

 

Query

Results

 UPDATE cn=testuser1,ou=testusers,o=stooges SET
departmentNumber='102',
departmentNumber='101'
basescope

Add multiple values of departmentNumber to entry cn=testuser1,ou=testusers,o=stooges

 

 

More Update Statement Examples (Using Not Operator)

 

Query

Reasons

 

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

 

Update postal code of all entries in and including ou=MemberGroupA,o=stooges where mail not equal to 'test@test.com' and sn not equals to 'test' to 60660

Update ou=MemberGroupA,o=stooges set postalCode= '60660' where mail != 'test@test.com'

Update postal code of all entries in and including ou=MemberGroupA,o=stooges where mail not equal to 'test@test.com' to 60660

 

Update An Attribute with Random Alphabets (Version 3.2 onwards)

 

Query

Reasons

UPDATE cn=testuser4,ou=testusers,o=stooges set userPassword=RandomAlphabets9



To Update a userPassword attribute of cn=testuser4,ou=testusers,o=stooges with Random Alphabets

UPDATE ou=testusers,o=stooges set userPassword=RandomAlphabets9 subtreescope

Update userPassword for all entries in container ou=testusers,o=stooges with Random Alphabets

 

 

Update An Attribute with Random Numbers (Version 3.2 onwards)

 

Query

Reasons

UPDATE cn=testuser4,ou=testusers,o=stooges set userPassword=RandomNumbers9



To Update a userPassword attribute of cn=testuser4,ou=testusers,o=stooges with RandomNumbers

UPDATE ou=testusers,o=stooges set userPassword=RandomNumbers9 subtreescope

Update userPassword for all entries in container ou=testusers,o=stooges

 

 

Update An Attribute with Time

 

Query

Reasons

Update cn=Larry Fine1,ou=MemberGroupA,o=stooges set homePhone=temp , description=CurrentTimestamp


Update cn=Larry Fine1,ou=MemberGroupA,o=stooges set homePhone=temp , description= CurrentTimestamp -2 months


Update cn=Larry Fine1,ou=MemberGroupA,o=stooges set homePhone=temp , description= CurrentTimestamp -7 days


Update cn=Larry Fine1,ou=MemberGroupA,o=stooges set homePhone=temp , description= CurrentTimestamp -1 years


Update cn=Larry Fine1,ou=MemberGroupA,o=stooges set homePhone=temp , description= CurrentTimestamp -1 hours


Update cn=Larry Fine1,ou=MemberGroupA,o=stooges set homePhone=temp , description= CurrentTimestamp -1 minutes


Update cn=Larry Fine1,ou=MemberGroupA,o=stooges set homePhone=temp , description= CurrentTimestamp -1 seconds

To update an attribute with current time stamp or current time stamp (-)(+) days|months|years|hours|minutes|seconds (Attribute must be of type time or you will get an error)

 

Related Links:

Difference b/w Update, UpdateAll and UpdateReplace

UpdateAdd statement

UpdateReplace statement

Select statement

Select statement Exampes

Insert statement

Delete statement examples

 


Ldapsoft Home page LDAP Admin & Reporting Tool Home Page