Solved

SQL2005 query into AD via LDAP

Posted on 2010-11-22
3
828 Views
Last Modified: 2012-05-10
Hi

I am querying AD via SQL 2005 but really want to get the description field out of AD but the description field seems to be a reserved word or something in the OLE DB connection as throws an error of "Msg 7346, Level 16, State 2, Line 1 Cannot get the data of the row from the OLE DB provider "ADsDSOObject" for linked server "ADSI". Could not convert the data value due to reasons other than sign mismatch or overflow."

I can retrieve any other field other than the description one

Here is a copy of the query

SELECT * FROM OPENQUERY
      (ADSI,'SELECT description FROM ''LDAP://########'' WHERE objectCategory = ''Computer'' ')

yet this works
SELECT * FROM OPENQUERY
      (ADSI,'SELECT location, physicalDeliveryOfficeName, department, displayName, SN,  
            givenName, sAMAccountName, manager, mail, telephoneNumber, mobile  
            FROM ''LDAP://########WHERE objectCategory = ''Computer'' ')

The AD server is setup as a linked server
0
Comment
Question by:techmiss
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 9

Expert Comment

by:Sander Stad
ID: 34187213
Could you try to put "[" and "]" around the field like this:

SELECT * FROM OPENQUERY
      (ADSI,'SELECT [description] FROM ''LDAP://########'' WHERE objectCategory = ''Computer'' ')
0
 

Accepted Solution

by:
techmiss earned 0 total points
ID: 34187307
I have tried all the usual field validators i.e. [, ' and " but none seem to make any difference.

I am not 100% sure that it is a reserved word but maybe its just a strange data type so I have even tried SELECT * FROM OPENQUERY
      (ADSI,'SELECT CAST(description as varchar(50)) FROM ''LDAP://########'' WHERE objectCategory = ''Computer'' ')

But dont think the OLE DB driver can handle data converting requests.

Thanks for your reply tho as any suggestions are welcome
0
 

Author Closing Comment

by:techmiss
ID: 34399285
Not really answered but found solution elsewhere :-(
0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will describe one method to parse a delimited string into a table of data.   Why would I do that you ask?  Let's say that you need to pass multiple parameters into a stored procedure to search for.  For our sake, we'll say that we wa…
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question