. the detail step to use the SQL Distributed Query by Using ADSI all list
in the KB http://support.microsoft.com/?id=299410
To set up a distributed join, first set up ADSI mapping using the
sp_addlinkedserver stored procedure in a SQL Server Tool such as SQL Query
Analyzer. This procedure links a name to an OLE DB provider name.
The following code is an example.
sp_addlinkedserver 'ADSI12', 'Active Directory Services 2.5',
You can also use sp_addlinkedsrvlogin to specify which user should be run.
Example of an sp_addlinkedsrvlogin call:
sp_addlinkedsrvlogin ADSI12, true, 'lab\administrator',
Then we can use SQL statement as follow:
select * from OpenQuery( ADSI12, 'select AdsPath, name from '
'LDAP://lab.com/cn=users,dc=lab,dc=com' ' ')
2. Active Directory performed without paging are limited to returning a
maximum of the first 1000 record. ADSI handles the page size
transparently. The client does not have to count the number of objects in
progress. ADSI encapsulates the server interaction for the client. From the
client perspective, the search comes back with a complete result set.
To specify a paged search, you need to set a value for
ADS_SEARCHPREF_PAGESIZE. This value is the number of items to return for
each page. You can also specify a time limit for the search by setting
ADS_SEARCHPREF_PAGED_TIME_LIMIT. This element specifies the maximum time,
in seconds, that the server should spend collecting a page of results
before returning the page to the client. If the limit is reached, the
server stops searching and returns the rows retrieved for the page. A paged
search is transparent to your application because ADSI automatically
continues to retrieve additional pages of results until it reaches the end
of the result set or the end of the time limit that you set.
So from client side, we just need to turn the parameters about these.
There is document about how to tune these parameters.
This posting is provided "AS IS" with no warranties, and confers no rights.