无法使用 ADSI 从 SQL 查询描述

Can't query for description from SQL using ADSI

我有一个使用 ADSI 的链接服务器。我可以成功查询除 description 以外的大多数属性。

我的查询:

SELECT * FROM OpenQuery (ADSI,  
    'SELECT description,sn,givenName
    FROM  ''LDAP://mydomain.com/OU=users,DC=com,DC=mydomain'' 
    WHERE title<>''Virtual'' AND (userAccountControl=''66048'' OR 
    userAccountControl=''512'')') 
ORDER BY sn

它抛出这个错误:

"Cannot get the data of the row from the OLE DB provider "ADSDSOObject" for linked server "ADSI". Could not convert the data value due to reasons other than sign mismatch or overflow."

这里有什么问题?

字段 description 是多值的。

看这里:

https://msdn.microsoft.com/en-us/library/ms675492(v=vs.85).aspx

SQL 服务器不支持多值字段,因此您无法在查询中获得该字段。