【问题标题】:Can't query for description from SQL using ADSI无法使用 ADSI 从 SQL 查询描述
【发布时间】:2017-06-24 00:54:58
【问题描述】:

我有一个使用 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."

这里有什么问题?

【问题讨论】:

    标签: sql sql-server active-directory adsi


    【解决方案1】:

    description 字段是多值的。

    看这里:

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

    SQL Server 不支持多值字段,因此您将无法在查询中获取该字段。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多