Problem with SQL subquery using Top () on Linked Server

I am using SQL Server 2008 and I have the following SQL script:

Select o.CustomerId as CustomerNoId, OrderValue, OrderDate
From dbo.Orders as o
Inner Join (
    Select Top (10) CustomerId
    From dbo.Customers
    where Age < 60
)
As c
On c.CustomerId = o.CustomerId

This works as desired when used with dbo.Customers and dbo.Orders on a local instance of SQL Server. It returns all rows from the order table for the first 10 customers returned from the Customers table - 1688 rows.

However, I do have a linked server containing Customers and Orders tables containing many more rows. When I modify the script to use the dbo.Orders and dbo.Customers tables on Linked Server, I get a strange result. The correct data seems to be correct, but only the first 10 lines of it.

I am not an expert on SQL, so I can’t understand why it should behave differently.

Any suggestions appreciated.

+4
2

, TOP (10), ORDER BY , , 10 ( - , , ).

ORDER BY , , .

+4

-, ORDER BY , @RBarryYoung.

-, (- table_source FROM), , REMOTE.

0

All Articles