Migrating to SQL Server 2008 / Windows Server 2008 64 bit from 2005/Windows Server 2003 32 bit, I have some core functionality querying AD through the ADSI Linked server. This has always worked great in SQL 2005.
SELECT TOP(100) PERCENT *
FROM openquery(adsi, '
WHERE objectCategory = 'Person' and objectClass = 'User' and userAccountControl=512 or userAccountControl=66048')
WHERE sAMAccountName like '%-%'
and sAMAccountName not like '%Acct%'
and sAMAccountName NOT LIKE ('$%')
and sAMAccountName NOT LIKE ('[_]'+'%')
ORDER BY sAMAccountName
My resultset through SQL 2008 is less. 4771 rows in (2005) vs. 4676 (2008)
Also I get an error message in (2008) when querying all (*) or greater than the number of rows.
For example, if I query top 4676 * result is fine, but *, top 4677 * or top(100) percent always returns
Msg 7330, Level 16, State 2, Line 1
Cannot fetch a row from OLE DB provider "ADsDSOObject" for linked server "adsi".
Any ideas where to look for this needle in the haystack, or has something changed?
View Complete Post