Hi guys,

I have set up a linked server in SQL and have a script getting data from Active Directory.
i want to limit the scope of the search, but i can't seem to get it to work.

Code:
INSERT INTO [database].dbo.TEMPADCONTACTS  (logon,givenName,lastName,displayName,title,email,phone,company,department,streetAddress)
    select  samaccountname,givenName,sn,cn,title,mail,telephoneNumber,company,department,streetAddress
    from OPENQUERY(ADSI,'select  samaccountname,givenName,sn,cn,title,mail,telephoneNumber,company,department,streetAddress  FROM ''LDAP://[SERVER]/ OU=users,DC=[domain]'' WHERE  objectCategory=''Person'' AND objectClass=''user'' ')
where mail is not null
order by 1
so that code is nice. it populates the temp table i created with all the users in AD that have something in the Email field.
but what i want to do is limit the search to ONLY that OU, not all the sub directories.
in theory there is a scope option "basescope" instead of the default "subtree", but i can't find the correct syntax to add it to the above query.

any one have any suggestions?

Cheers,
Lukus