Hello,
I am trying to use openquery with two ou. However, I am getting following error.
Below is my script:
select displayName,DEPARTMENT,mail,physicalDeliveryOfficeName,telephoneNumber
from OpenQuery ( ad,
'SELECT
employeeid, sAMAccountName,instanceType,objectCategory, mail
,displayName, DistinguishedName
,department,isDeleted,name
,logoncount
,createTimeStamp,modifyTimeStamp
,lastLogonTimestamp, lastlogon
,UserAccountControl
,physicalDeliveryOfficeName
,telephoneNumber
FROM ''LDAP://OU=Faculty,OU=Staff,DC=domain,DC=com''
WHERE objectClass = ''User''
')
Here is the error message that I am getting:
Msg 7321, Level 16, State 2, Line 1
An error occurred while preparing the query "SELECT
employeeid, sAMAccountName,instanceType,objectCategory, mail
,displayName, DistinguishedName
,department,isDeleted,name
,logoncount
...
↧
Openquery with two ou in sql
↧