all groups > sql server dts > may 2004 >
You're in the

sql server dts

group:

Active Directory



Active Directory Robert E. Flaherty
5/28/2004 11:11:40 AM
sql server dts: What options are there for importing and exporting from SQL Server to Active
Directory?

Re: Active Directory Partha Mandayam
5/28/2004 11:57:43 AM
To join Active Directory Data with SQL Server Data

Run the Query Analyzer (Start | Programs | Microsoft SQL Server 2000)
Log on to the SQL Server computer.
Execute the following line (by highlighting it and pressing CTRL+E):

sp_addlinkedserver 'ADSI', 'Active Directory Service Interfaces',
'ADSDSOObject', 'adsdatasource'
go
This directs SQL Server to associate the word "ADSI" with the ADSI OLE
DB provider, "ADSDSOObject."

You can now access Active Directory from SQL Server.

Type and execute:


SELECT * FROM OpenQuery( ADSI, 'SELECT name, adsPath FROM
"LDAP://DC=Fabrikam,DC=com" WHERE objectCategory = "Person" AND
objectClass= "user"")
You can also use the ADSI LDAP dialect. For example:


SELECT * FROM
OpenQuery(ADSI,'<LDAP://DC=Fabrikam,DC=COM>;(&(objectCategory=Person)(ob
jectClass=user));name,


Regards

Partha Mandayam
Software Consultant
Home page: http://partha.tripod.com


*** Sent via Developersdex http://www.developersdex.com ***
AddThis Social Bookmark Button