November 30, 2006 at 1:45 pm
I am having trouble querying one particular active directory attribute, managedObjects. The error message that I'm getting is:
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.
The query runs fine if that field is NULL. I found a kb article on Microsoft's site stating that it is an issue, but we have a later version of the file listed (activeds.dll). The cause listed is as follows:
The ADSI OLE DB provider represents I8 fields by using a DBTYPE_VARIANT(IDispatch) data type and does not convert the I8 data type to a string. SQL Server requires the provider to convert a VARIANT data type to a WSTR data type.
I've tried converting the field to nvarchar, nchar, text and none of them works. Here's my query:
SELECT
Manager, Name, sAMAccountName, userPrincipalName, convert(nvarchar, ManagedObjects)
FROM
OPENQUERY(ADSI,
'SELECT Name, Manager, sAMAccountName, userPrincipalName, DisplayName, ManagedObjects
FROM ''LDAP://OU=xxxx,DC=xxxx,DC=com''
WHERE objectCategory = ''User''
ORDER BY Name')
Does it need to be converted within the openquery statement, or is there something else that I can try?
Thanks!
December 4, 2006 at 8:00 am
This was removed by the editor as SPAM
September 12, 2012 at 5:02 am
I am having a similar issue. If I run the following query in SQL 2005 it runs fine but gives an error in SQL 2008.
SELECT *
FROM OPENQUERY(ADSI, 'SELECT sAMAccountName, ipPhone, department,
displayName, homePhone, mail, mobile, company,
sn, l, telephoneNumber, givenName, title,
physicalDeliveryOfficeName
FROM ''LDAP://OU=xxx,DC=xxx,DC=xxx'' WHERE
objectCategory = ''Person'' AND objectClass = ''user'' ')
where company is not null
The error is -
Msg 7330, Level 16, State 2, Line 1
Cannot fetch a row from OLE DB provider "ADSDSOObject" for linked server "ADSI".
It seems to error after a certain number of rows (which is different everyday). If I amend the query to include the Top N clause it runs fine. That is not a solution, searching on the internet has yielded no clues.
Any thoughts anyone.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply