title: Querying LDAP from SQL Server issue
body: <p>I'm having some trouble configuring a SQL statement to perform an openquery on LDAP from SQL Server. I followed the instructions as laid out here: <a href="https://stackoverflow.com/questions/1251038/querying-active-directory-from-sql-server-2005">Querying Active Directory from SQL Server 2005</a> but I'm having some trouble putting the final pieces together. </p>
  
  <p>Firstly, I didn't know where my LDAP server was. So I did a <code>nslookup</code> and found the default server as:</p>
  
  <pre><code>abc.domain.popo.local
  </code></pre>
  
  <p>I configured my <code>OPENQUERY</code> as </p>
  
  <pre><code>SELECT * FROM OPENQUERY( ADSI, 'SELECT * FROM ''LDAP://DC=abc,DC=domain,DC=popo,DC=local'' WHERE
  objectCategory = ''User''')   
  </code></pre>
  
  <p>However, I get an error saying that</p>
  
  <blockquote>
    <p>An error occurred while preparing the query "SELECT * FROM 'LDAP://DC=abc,DC=domain,DC=popo,DC=local' WHERE objectCategory = 'User'" for execution against OLE DB provider "ADSDSOObject" for linked server "ADSI".</p>
  </blockquote>
  
  <p>What is the likely issue here? Am I setting up the <code>DC</code> incorrectly (because I don't even know what DC means)? Or is it more likely that I just have the wrong server altogether for LDAP?</p>