Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
lightningtechie
Starting Member
1 Post |
Posted - 2006-02-07 : 07:18:36
|
| we are trying to execute a remote sql query from one sql server against another. Both servers are in the same domain. The query is a simple select * from tablename where surname = whatever. We precede this with an 'opendatasource' statement. The query returns only a few rows. When we run the query between two sql servers on the same lan segment the query runs in a second or two. When we run the query between servers on two different network segments (seperated by a firewall) but still both in the same domain the same query takes 50+ seconds to run. Looking further, it seems that the query is actually being executed on the local server so the entire table (over 1 million rows) is copied locally before running the query. How can I run the query as a remote query so that the entire query is run on the remote sql server and only the query results are passed accross the network to the local server? I have also tried creating a linked server and using OPENQUERY but still takes ages to run.Thanks |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2006-02-07 : 08:32:10
|
| On the linked server set the link to collation compatible.If that doesn't work use sp_executesql to execute on the remote server. That will mean that the query will not be parsed on the local server (it's just a string) so will have to be executed remotely.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|
|