Question : LDAP Query help

I am trying to grab all the records from our AD in an import everyday through an SSIS package. LDAP only returns 1000 records and my server team is unwilling to make changes due to security risk. So I was going to do a union query of all the letters in the alphabet. I can't get my like portion too work. Can someone tell me what I am missing? Or if you know of a way to grab all the records that would be great too.

SELECT     TOP (100) PERCENT objectGuid, sAMAccountName, givenname, mail, sn, name
FROM         OPENQUERY(ADSI,
                      'SELECT name, sn, mail,givenname,sAMAccountName, objectGuid
      FROM ''LDAP:// DC=silicon,dc=cali,dc=org''
      WHERE objectCategory=''Person'' AND
      objectClass = ''user'' AND sAMAccountName like ''%A%''')
                       AS derivedtbl_1
ORDER BY sn, givenname

Answer : LDAP Query help

see this link for some info
http://forums.asp.net/p/1029112/1408333.aspx
and this one as well
http://forums.devshed.com/ldap-programming-76/ldap-query-with-like-288394.html

Random Solutions  
 
programming4us programming4us