question

Don 1 avatar image
Don 1 asked

SQL openquery puzzle

Select * From OpenQuery (Ftw003, 'Select * From Mold');

Returns one row from a table that has 12837 records

linked-serveropenquery
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Rob Farley avatar image
Rob Farley answered

Try using OPENROWSET instead. It could be something around the fact that OQ only returns one resultset, which could perhaps be getting confused depending on what your linked server is.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Ian Roke avatar image
Ian Roke answered

Something like this should hopefully do the trick?

SELECT *
FROM OPENROWSET(
    'SQLNCLI', 
    'Server=Ftw003;Trusted_Connection=yes;',
    'SELECT * FROM Mold'
);
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.