Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Slow query on remote server

$
0
0

Hi

I am running a query as below;

INSERT INTO tblEvents( <fields list> )
SELECT <fields list> 
FROM  OPENROWSET('SQLNCLI', 'Server=<ip address>;DATABASE=MyDB;Uid=sa;Pwd=MyPassword;', 'SELECT * FROM tblEvents') AS a
WHERE (ID = 68596)

Problem is that below part of query runs very slow (takes around 3 mins to complete) even though it just needs to bring one row.

SELECT <fields list> 
FROM  OPENROWSET('SQLNCLI', 'Server=<ip address>;DATABASE=MyDB;Uid=sa;Pwd=MyPassword;', 'SELECT * FROM tblEvents') AS a
WHERE (ID = 68596)

What is the problem and how can I speed it up?

Thanks

Regards


Viewing all articles
Browse latest Browse all 23857

Trending Articles