title: Retrieve >901 rows from SQL Server 2008 linked server to Active Directory
body: <p>In SQL Server 2008 (version 10.0.4000) I have created a linked server to an Active Directory server.</p>
  
  <p>This query:</p>
  
  <pre><code>select  TOP 901 *
  from  openquery(adsisca, '
  select  givenName,
                  sn,
                  sAMAccountName          
  from    ''LDAP://10.1.2.3:389''
  where   objectCategory = ''Person''
          and
          objectClass = ''InetOrgPerson''
  ')
  </code></pre>
  
  <p>works.</p>
  
  <p>However changing the query and trying to retrieve 902 rows does not :</p>
  
  <pre><code>select  TOP 902 *
      from  openquery(adsisca, '
      select  givenName,
                      sn,
                      sAMAccountName          
      from    ''LDAP://10.1.2.3:389''
      where   objectCategory = ''Person''
              and
              objectClass = ''InetOrgPerson''
      ')
  </code></pre>
  
  <p>The error is:</p>
  
  <blockquote>
    <p>Msg 7330, Level 16, State 2, Line 1
    Cannot fetch a row from OLE DB
    provider "ADSDSOObject" for linked
    server "adsisca".</p>
  </blockquote>
  
  <p>I've found other instances of people discussing the same problem on forums and they never fixed it, just worked around it writing multiple views and union'ing them together for example.</p>
  
  <p>Is there a more elegant fix, is there a setting I can change somewhere to retrieve more than 901 rows?</p>