waverazor
asked on
Querying Active Direct using T-SQL
I'm querying active directory using the syntax below. The query returns no rows even though distinguishedName contains the characters "XYZ". I'm attempting to do a "Like" comparison. Records are returned when I use this "where" clause: Where sn = ''*lber*''
Select *
From OpenQuery(ADSI,'Select distinguishedName
, title
, displayName
, sAMAccountName
, mail
, mobile
, department
, manager
, adspath
From ''LDAP://DC=mydomain,DC=COM''
Where distinguishedName = ''*XYZ*''')
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I have a 1,000 row limit on queries. Will the OpenQuery stop at the 1,000 row limit before before the second "where" clause filters?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
EDIT: hmm, it is not the subtree issue. It is doing that properly. I search on sAMAccountName and works fine. I know I have used distinguishedName before, so testing before posting again.