title: How get multi value data form Active Directory using SQL
body: <p>Is it possible to get multi value properties form AD like description, memberOf. if I run simply by adding memberOf this gives error </p>
  
  <pre><code>select * 
  FROM OPENQUERY(ADSI,'SELECT initials, samAccountName, displayName, distinguishedName, mail, memberOf FROM ''LDAP://DC=corp, DC=contoso, DC=com'' WHERE objectClass=''Person''')
  </code></pre>
  
  <p>Error:</p>
  
  <blockquote>
    <p><em>Msg 7346, Level 16, State 2, Line 1<br>
    Cannot get the data of the row
    from the OLE DB provider "ADSDSOObject" for linked server "ADSI".
    Could not convert the data value due to reasons other than sign
    mismatch or overflow.</em></p>
  </blockquote>
  
  <p>This is because of memberOf is multi valued property in Active Directory. I am using SQL Server 2008 R2</p>