Active Directory数据到SQL表 [英] Active Directory data into SQL table
本文介绍了Active Directory数据到SQL表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我将如何解压的Active Directory信息(用户名,名字,姓氏)和填充SQL表的结果?
How would I extract Active Directory info (Username, first name, surname) and populate an SQL table with the results?
感谢
斯科特
推荐答案
如果你只需要在SQL中,我使用以下
If you just need it in SQL, I'm using the code below
INSERT...
SELECT A.SAMAccountName, A.Mail, A.displayName FROM
(SELECT * FROM OpenQuery(ADSI, 'SELECT title, displayName, sAMAccountName, givenName, telephoneNumber, facsimileTelephoneNumber, sn, userAccountControl,mail
FROM ''LDAP://domain.ro/DC=domain,DC=ro'' where objectClass = ''User''')
WHERE (sn is not null) and (givenName is not null) and (mail is not null) )A
其中,ADSI是在此基础上创建了一个链接的服务器: http://msdn2.microsoft.com/en-us/库/ aa772380(VS.85)的.aspx
where ADSI is a linked server created based on this: http://msdn2.microsoft.com/en-us/library/aa772380(VS.85).aspx
这篇关于Active Directory数据到SQL表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文