title: Error : Cannot fetch a row from OLE DB provider "ADsDSOObject" for linked server "ADSI"
body: <p>When I attempt to query AD for users I receive the following error:</p>
  
  <p>Cannot fetch a row from OLE DB provider "ADsDSOObject" for linked server "ADSI".</p>
  
  <p>I assume the issue due to the 1000 row limit (or 901 rows in SqlServer 2008). I can page the query but I am looking for workaround that would allow me to retrieve more than 1000 at a time. </p>
  
  <p>In case it helps, I am using SqlServer 2008 R2. 
  and here is my query</p>
  
  <pre><code>SELECT  samaccountname AS Account, ISNULL(givenName, '''') AS givenName, ISNULL(SN, '''') AS SN, ISNULL(DisplayName, '''') as DisplayName, ISNULL(Title, '''') AS Title 
                          FROM OpenQuery(ADSI, 
                          'SELECT SamAccountName, givenName, SN, DisplayName, Title
                          FROM ''LDAP://corpdomain.corp'' 
                          WHERE objectClass = ''User'' and (SN = ''*'' or givenName = ''*'')')
  </code></pre>
  
  <p>Any ideas?</p>
  
  <p>EDIT - 
  Upon further inspection I realized I am not able to properly page this query either. Does anyone have any tips on a solution that will allow me to page the results or a workaround that will allow me to return more than 901?</p>