There are several ways but the most commonly used approach of using linked servers hits ona  1000 row limit in the AD OLE DB Provider, here is a solution using SQL CLR, I have not tried it but if it works as advertised then it should help, beware it does use SQLCLR.