\
Skip Navigation LinksHome > eZine > Ask Vance\
 
 
Vance Hunt has provided home-user help desk style support for his consulting company for over 6 years. Making his home in beautiful Southern California, Vance provides general computer Q&A for users via his weekly column.

[]View Current Column
[]Ask Vance A Question
[]Browse Other Dates



 
Icon of Vance HuntFriday, May 09, 2008
Fun with Filters - not coffee filters.
By Vance Hunt
 
Shout-Back! Read Comments  |  Post A Comment

Q: I need to query the active directory to obtain a list of disabled user accounts.  I have a security group which has user objects I wish to exclude from the query.  Is it possible to filter at the LDAP query level?
 
A: Yes.  A normal LDAP query to return disabled accounts looks like this (more or less):

;(&(objectCategory=User)
    (userAccountControl:1.2.840.113556.1.4.803:=2));Name;Subtree

You can read more on this here

You can add an additional filter to the LDAP query using the memberOf property, negating it in the search criteria as such:

;(&(objectCategory=User)
    (!(memberOf= CN=Group,OU=Org,DC=domain,DC=xxx))
    (userAccountControl:1.2.840.113556.1.4.803:=2));Name;Subtree

Will filter those special accounts right out.



Q: I am looking to export some data from a relational database. I need to make a text field which is not the primary key in the existing table into the primary key for the export, but as I was going thru some of the data, I found unexpected duplicate data in my assumed unique field. There are too many records to search thru by a standard sort - is there a way to filter based on duplicates?
 
A: You can request from SQL a count of duplicates fairly quickly.  I'll use MS SQL as that is what I have and you can adjust for your flavor as needed:

SELECT columnName, COUNT(columnName) as CountOfCol
FROM tableName
GROUP BY columnName
HAVING (COUNT(columnName ) > 1))

Where columnName  is the name of the column you need to test, and tableName is the table to test.  This will return a table showing you the data and its number of occurrences.




Comments: [0]   [Show Disclaimer]

Post a Comment
Display Name:
Comment:
(Plain text only - all HTML will be stripped)

Previous Ask Vance Questions:

 FAQs  |  Terms Of Use  |  Privacy Policy  |  Contact Us
Copyright © 1997 - 2010 Dx21, LLC. All rights reserved.
Dx21, LLC a Washington Limited Liability Company
Page Rendered at: 9/9/2010 12:25:17 PM for Unknown