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
|