Re: OPENQUERY UPDATE Syntax help needed
- From: Erland Sommarskog <esquel@xxxxxxxxxxxxx>
- Date: Wed, 25 Apr 2007 21:49:30 +0000 (UTC)
(rshivaraman@xxxxxxxxx) writes:
I am updating a local table based on inner join between local table
and remote table.
Update LocalTable
SET Field1 = B.Field1
FROM LinkedServer.dbname.dbo.RemoteTable B
INNER JOIN LocalTable A
ON B.Field2 = A.Field2
AND B.Field3 = A.Field3
This query takes 18 minutes to run.
I am hoping to speed up the process by writing in OPENQUERY syntax.
UPDATE LocalTable
SET Field1 = B.Field1
FROM OPENQUERY(LINKEDSERVER,
'SELECT Field1, Field2, Field3 FROM dbname.dbo.RemoteTable) B
INNER JOIN LocalTable A
ON B.Field2 = A.Field2
AND B.Field3 = A.Field3
I would not really expect this to perform better.
Distributed queries are always difficult, but it's difficult to suggest
anything without further knowledge about the table. How big are the
two tables?
--
Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
.
- References:
- OPENQUERY UPDATE Syntax help needed
- From: rshivaraman
- OPENQUERY UPDATE Syntax help needed
- Prev by Date: Re: How to Generate all grants to a user role? (SQL Server 2000)
- Next by Date: Re: getdate() problem: where is the time taken from ?
- Previous by thread: OPENQUERY UPDATE Syntax help needed
- Next by thread: Monitor Object Access
- Index(es):
Relevant Pages
|