Limit SQL / LDAP query to 901 rows

I have the following LDAP / SQL query used in the SSIS ADO.NET package and I'm trying to figure out how to limit rows to 901:

SELECT displayName, cn, extensionAttribute5, streetAddress, telephoneNumber, otherTelephone, info, department, company, givenName, mobile, physicalDeliveryOfficeName, facsimileTelephoneNumber, sn, title, mail FROM 'LDAP://OU=*****,OU=*****,OU=*****,DC=*****,DC=*****,DC=*****' WHERE objectCategory = 'Person' AND objectClass = 'User' 
0
source share
1 answer

Try the following:

 with x as( SELECT * FROM OpenQuery ( ADSI, 'SELECT adspath, samaccountname FROM ''LDAP:// ...'' WHERE objectClass = ''User'' order by samaccountname ') AS tblADSI ) select top 901 adspath, samaccountname from x 
0
source

Source: https://habr.com/ru/post/1482559/


All Articles