The main problem is that the double quotes around the LDAP query need to be doubled single quotes.
The LDAP query can include as server name or IP and/or a LDAP specification.
Some queries that work for me:
SELECT * FROM OPENQUERY
(ADSI,'SELECT NAME FROM ''LDAP://*ldap.server.name*''')
SELECT * FROM OPENQUERY
(ADSI, 'SELECT name, sAMAccountName, distinguishedName
FROM ''LDAP://DC=*mycompany*, DC=*mytld*''
WHERE objectCategory = ''Person'' AND objectClass = ''user''')
SELECT * FROM OPENQUERY
(ADSI,'SELECT name, sAMAccountName, distinguishedName
FROM ''LDAP://*ldap.server.name*/OU=ITDept, OU=users, OU=DC, OU=Corporate, DC=*mycompany*, DC=*mytld*''
WHERE objectCategory = ''Person'' AND objectClass = ''user''')
Once again... there are no double quotes in the above... multiple single quotes.
ADSI needs to be registered/linked with
EXEC sp_addlinkedserver 'ADSI', 'Active Directory Service Interfaces', 'ADSDSOObject', 'adsdatasource'
if you have permissions issues you can set the account used under the security property tab on the ADSI linked server.
Active Directory is a database based system that provides authentication, directory, policy, and other services in a Windows environment
LDAP (Lightweight Directory Access Protocol) is an application protocol for querying and modifying items in directory service providers like Active Directory, which supports a form of LDAP.
Short answer: AD is a directory services database, and LDAP is one of the protocols you can use to talk to it.
Best Answer
I guess your problem is the fact that AD can store multiple values in a single field (quite contrary to the very first normalization rule in relational databases).
Not sure what your query looks like - but could you possibly try to add a "[0]" indexer to the description attribute, by any chance??
Marc