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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 Linked Server Error with Domain Admin
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Yak Posting Veteran

76 Posts

Posted - 04/03/2013 :  13:38:16  Show Profile  Reply with Quote
I am getting this error when querying the Active Directory

Msg 7321, Level 16, State 2, Line 27
An error occurred while preparing the query "SELECT DisplayName, title,mail
FROM 'LDAP://CBC-03/DC=jhcohn,DC=com'
WHERE objectClass = 'Person'
" for execution against OLE DB provider "ADsDSOObject" for linked server "ADSI".

I am not the DOmain Admin, but the lady that is gets the same error.

Here is the Code that linked the server:

EXEC master.dbo.sp_addlinkedserver @server = N'ADSI',
@srvproduct=N'Active Directory Services', @provider=N'ADsDSOObject',
@datasrc=N'' --AKA the full computer name of the AD server

Here is the query code:

'SELECT DisplayName, title,mail
FROM ''LDAP://CBC-03/DC=jhcohn,DC=com''
WHERE objectClass = ''Person''

Any ideas, thanks in advance

Bryan Holmstrom

Flowing Fount of Yak Knowledge

United Kingdom
2179 Posts

Posted - 04/03/2013 :  14:59:29  Show Profile  Visit jackv's Homepage  Reply with Quote
what sql server version are you running?

Jack Vamvas
Go to Top of Page


5072 Posts

Posted - 04/03/2013 :  15:47:06  Show Profile  Visit russell's Homepage  Reply with Quote
Might want to look at this thread
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000