如何返回从ADSI OPENQUERY一列中的所有数据?数据、ADSI、OPENQUERY

2023-09-09 21:41:21 作者:當愛已成往事

我试图从Active Directory获取OPENQUERY varbinary数据类型(具体而言,thumbnailPhoto'属性),但是,它似乎截断回到了256个字符的数据。我用了一个活动目录应用程序,查看当前存储的数据,它是小于256位的大了很多,所以肯定是有数据截断的问题。

I'm trying to get a varbinary datatype from Active Directory openquery (specifically, the 'thumbnailPhoto' attribute), however, it seems to truncate the data returned to 256 characters. I used an Active Directory application to see the data that is currently stored and it is a lot bigger than 256 bits so there is definitely a problem with data truncation.

我的查询看起来是这样的:

My query looks like this:

SELECT     *
FROM         OPENQUERY(ADSI, 
                      'SELECT thumbnailPhoto
FROM ''LDAP://X.X.X.XXX/OU=XX,OU=XX,dc=XX,dc=XX''  
where objectClass = ''User''')

我已经试过铸造研究如何/在OPENQUERY内进行转化,但它似乎要么是不可能的和/或从来没有讨论过。

I have tried researching ways of casting/converting within the openquery but it seems to either not be possible and/or never discussed.

推荐答案

事实证明,这是非常困难的与SQL Server接口,AD工作所以我要做的就是使用DirectorySearch .NET库以及LDAP查询( http://technet.microsoft.com /en-us/library/aa996205(v=exchg.65).aspx ),以获得从公元的所有信息,没有任何数据被截断。

As it turns out, it is very difficult to work with the SQL Server interface to AD so what I had to do was use the DirectorySearch .net library along with LDAP querying (http://technet.microsoft.com/en-us/library/aa996205(v=exchg.65).aspx) to obtain all the information from AD without any data truncation.