title: How to return all data in a column from ADSI Openquery?
body: <p>I'm trying to get a varbinary datatype from Active Directory openquery (specifically, the 'thumbnailPhoto' attribute), however, it seems to truncate the data returned to 256 characters. I used an Active Directory application to see the data that is currently stored and it is a lot bigger than 256 bits so there is definitely a problem with data truncation.</p>
  
  <p>My query looks like this:</p>
  
  <pre>SELECT     *
  FROM         OPENQUERY(ADSI, 
                        'SELECT thumbnailPhoto
  FROM ''LDAP://X.X.X.XXX/OU=XX,OU=XX,dc=XX,dc=XX''  
  where objectClass = ''User''')</pre>
  
  <p>I have tried researching ways of casting/converting within the openquery but it seems to either not be possible and/or never discussed. </p>