[英]LDAP OpenQuery returns only one column ADsPath
I have added my Domain Controller as a linked server to SQL Server in order to pull some data from active directory and populate my tables with it. 我已将域控制器作为链接服务器添加到SQL Server,以便从活动目录中提取一些数据并用它填充表。 After that, I have executed an OpenQuery to get the users list in my domain
之后,我执行了OpenQuery以获取我域中的用户列表
SELECT * FROM OpenQuery(ADSI, 'SELECT * FROM ''LDAP://OU=SmallOU, DC=MyDOMAIN,DC=xx,DC=xx'' WHERE objectClass=''User'' ')
I have performed the query against a small OU since performing the query against the whole directory returned errors because of number of rows limitation 由于对行数的限制,对整个目录执行查询返回错误,因此我对一个小OU执行了查询
Surprisingly, the query returns only one column " ADsPath
", whereas I expected to get sAMAccount
, Title
, Last Name
, .... ,etc. 令人惊讶的是,查询仅返回一列“
ADsPath
”,而我希望得到sAMAccount
, Title
, Last Name
,....等。
I want to get all the users data, how can I do that? 我想获取所有用户数据,该怎么办?
The provider will not try to find out which attributes to retrieve, if you use the asterisk with the SQL syntax. 如果您在SQL语法中使用星号,则提供程序将不会尝试找出要检索的属性。 Instead of
SELECT *
you must specify the attributes you want like SELECT sAMAccountName, sn, givenName
. 而不是
SELECT *
您必须指定所需的属性,例如SELECT sAMAccountName, sn, givenName
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.