By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,213 Members | 2,172 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,213 IT Pros & Developers. It's quick & easy.

SQL Active Directory Query

P: 1
Hi

I am trying to write a query that will select all users in the Organization bucket in active directory. The problem is that within the Organization bucket, there are many other buckets. I want to filter/exclude one bucket.

Example:

+Organization

++Store1
+++User1
+++User2

++Store2
+++Users...

++Store3
+++Users...

I want to select all the Stores, except for Store3


Here is the query I have so far:
The query selects all active users in Organization

SELECT * FROM OPENQUERY(ADSI,
'<LDAP://OU=Organization,DC=sara-tx,DC=org>;(&(objectCategory=Person)(objectClass=U ser)(!userAccountControl:1.2.840.113556.1.4.803:=2 ));cn,givenName,sn,userAccountControl,telephoneNum ber,mail,department,title,physicalDeliveryOfficeNa me,company;subtree')
order by sn


Please help
Nov 22 '06 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.