Link to home
Start Free TrialLog in
Avatar of blossompark
blossomparkFlag for Ireland

asked on

Get error when querying Active Directory From SQL Server ADSI Linked Server

Hi,
I have an ADSI Linked Server on a SQL Server 2014 server which  seems to be connected ok
User generated image
However when I run the following query
Select * 
  FROM OPENQUERY
( ADSI, 'SELECT extensionAttribute3, extensionAttribute2, employeeType, manager, streetAddress, 
physicalDeliveryOfficeName, mobile, ipphone, department, company, info, title, employeeID, mail, telephoneNumber, 
displayName, sAMAccountName
FROM ''LDAP://ou=cccusers,dc=europe,dc=global'' WHERE objectCategory = ''Person''' )

Open in new window

i get the error message
Msg 7321, Level 16, State 2, Line 19
An error occurred while preparing the query "SELECT extensionAttribute3, extensionAttribute2, employeeType, manager, streetAddress,
physicalDeliveryOfficeName, mobile, ipphone, department, company, info, title, employeeID, mail, telephoneNumber,
displayName, sAMAccountName
FROM 'LDAP://ou=cccusers,dc=europe,dc=global' WHERE objectCategory = 'Person'" for execution against OLE DB provider "ADSDSOObject" for linked server "ADSI".

Any guidance appreciated
Thanks
Avatar of Shreedhar Ette
Shreedhar Ette
Flag of India image

Please use the as FROM String ans see

LDAP://europe.global/ou=cccusers,dc=europe,dc=global
Avatar of blossompark

ASKER

Hi Shreedhar, same error
ASKER CERTIFIED SOLUTION
Avatar of Shreedhar Ette
Shreedhar Ette
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks Shreedhar, have not resolved the issue but closing for now