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 2008 Forums
 Transact-SQL (2008)
 Query LDAP

Author  Topic 

fralo
Posting Yak Master

161 Posts

Posted - 2012-03-14 : 17:22:27
Hi all,

I'm not sure if I'm posting this in the right spot.

I'm trying to query from active directory.

select name,email from test_table
where email in
(SELECT mail FROM OpenQuery
(ADSI, 'SELECT mail
FROM ''LDAP://DC=####,DC=####,DC=###,DC=###''
where objectClass = ''user''
'))

The error is:

OLE DB provider "SQLNCLI10" for linked server "ADSI" returned message "Deferred prepare could not be completed.".
Msg 8180, Level 16, State 1, Line 1
Statement(s) could not be prepared.
Msg 102, Level 15, State 1, Line 2
Incorrect syntax near 'LDAP://DC=####,DC=###,DC=###,DC=###.

Any help would be appreciated.
   

- Advertisement -