Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Querying Active directory

Author  Topic 

schinni
Yak Posting Veteran

66 Posts

Posted - 2003-03-31 : 20:33:23
Is there a way we can query active directory from Sql Server 2000
i want to query and get some data from active directory and load into
sql2k,right now this is done using visual basic.

Thanks in advance.

efelito
Constraint Violating Yak Guru

478 Posts

Posted - 2003-04-01 : 10:00:31
You can setup a linked server to AD and use it to run queries. I've done it against Exchange. Here is what I used to create a linked server connection to exchange.

sp_addlinkedserver
@server = 'ADSI',
@srvproduct = 'Active Directory Service Interfaces',
@provider = 'ADSDSOObject',
@datasrc = 'adsdatasource'
go

sp_addlinkedsrvlogin
@rmtsrvname = 'ADSI',
@useself = 'FALSE',
@rmtuser = null,
@rmtpassword = null
go


You will need to do some hunting around to get the query syntax just right, but that should get you started.

Jeff Banschbach
Consultant, MCDBA
Go to Top of Page
   

- Advertisement -