question about querying Active Directory

  • I've linked to AD and can execute the following query. It returns a result set (GREAT) but also an error message (WHY?).

    --query

    SELECT * FROM OPENQUERY (

    ADSI,

    'SELECT displayName, sn, givenName

    FROM ''LDAP://domainobfuscated"

    WHERE objectClass = ''USER''')

    --what does this mean?

    Msg 7330, Level 16, State 2, Line 1

    Cannot fetch a row from OLE DB provider "ADsDSOObject" for linked server "ADSI".

    If I add one more filter criteria, it works without error:

    SELECT * FROM OPENQUERY (

    ADSI,

    'SELECT displayName, sn, givenName

    FROM ''LDAP://domainobfuscated"

    WHERE objectClass = ''USER''

    and givenName = ''Sanjay''')

    I would like to understand the error, to know if it's a problem. Probably one of the skilled SQL users here can answer?

    --Quote me

  • The results returned over a linked server to Active Directory are limited to somewhere around 1000 if memory serves me. Anything more than that and you will get an error. I'm guessing that's the problem you are running into.

  • the query that errored only returned 901 rows, so I don't think it's that...unless MaxPageSize is limited to 901 on our AD. You really think so?

    --Quote me

  • I think you are right. And in my case the AD must be limited to 901.

    OK. Thanks.

    --Quote me

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply