none
Querying Active Directories Issue

    Question

  • While I am familiar with SQL, I am having trouble retrieving data from Active Directories.  I have followed all the instructions to create a linked server, I have set the security per the documentation.  I have coded the openquery statement per the examples but I keep receiving the same error message. 

    SELECT *
          FROM OPENQUERY
          (ADSI
           , 'SELECT displayName, userPrincipalName
                 FROM ''LDAP://buf-dc-002/DC=mig,DC=local''
              WHERE objectClass = ''Person''')

    Msg 7321, Level 16, State 2, Line 1
    An error occurred while preparing the query "SELECT displayName, userPrincipalName
                 FROM 'LDAP://buf-dc-002/DC=mig,DC=local'
              WHERE objectClass = 'Person'" for execution against OLE DB provider "ADsDSOObject" for linked server "ADSI".

    I cannot seem to find any information on why I am receiving this message.  Any assistance would be greatly appreciated. 

    Wednesday, July 24, 2013 5:12 PM

Answers