Re: Distributed Query Problems

From: CPK (VirtualChris_at_Yahoo.com)
Date: 10/29/04


Date: Fri, 29 Oct 2004 19:10:58 -0400

Try making your own variation of this example,

DECLARE @TSQL varchar(8000), @VAR char(2)
SELECT @VAR = 'CA'
SELECT @TSQL = 'SELECT * FROM OPENQUERY(remoteserver,''SELECT * FROM
pubs.dbo.authors WHERE state = ''''' + @VAR + ''''''')'
EXEC (@TSQL)

"Jeff B" <Jeff B@discussions.microsoft.com> wrote in message
news:159F61BA-F766-4F73-89D6-F082DE24F259@microsoft.com...
> OK... On the local server I have a table with 1,000,000 records. I am
> selecting 200 records from this table, and joining on an id column to a
table
> with 2,000,000 records on the remote server. The query should only retun
> about 200 records. When I look at the query plan, I see that the remote
query
> is actually fetching all 2,000,000 records from the remote server. This
> doesn't seem right. Are there any tricks to get the remote part of the
query
> to apply a where clause?



Relevant Pages

  • troubleshooting no response to wmi query on remote server
    ... I've written a perl script to query the event logs on remote servers. ... In checking the wbemcore.log on a problematic remote server, ...
    (microsoft.public.win32.programmer.wmi)
  • Re: missing indexes
    ... My sql version is: Microsoft SQL Server ... >I've simplified the query a little, but it's still causing the error in my ...
    (microsoft.public.sqlserver.programming)
  • WMI Mystery
    ... I have a remote server somewhere, ... Accessing it through WMI Explorer works just fine with a user id + ... I can connect and execute queries correctly. ... Query for operating system name failed. ...
    (microsoft.public.win32.programmer.wmi)
  • Re: remote query
    ... Did you meant tuning the "Query" in remote server. ... Open the query and execute using "Execution Plan' ...
    (microsoft.public.sqlserver.server)
  • Re: Compare Substrings
    ... > query a lot of records are sent as result but i expect no ... declare @P1 bigint set @P1=NULL exec Content_Save ...
    (microsoft.public.sqlserver.server)