Quantcast
Channel: Forum SQL Server Database Engine
Viewing all articles
Browse latest Browse all 15889

WITH (NOLOCK) across a linked server

$
0
0
Hi,

I have a SProc that copies data from a database on a linked server to another database on the current server.  The process is only updating/inserting data into the database on the current server. I want to make sure the process - which takes place in the middle of a transaction - does not hold any locks on the database in the linked server. I was thinking of adding WITH (NOLOCK), but I am unsure if that hint will matter across a linked server. Anyone know?

Below is a sample of the insert/select statements I am performing within the transaction in the SProc:



INSERT
INTO [Database].dbo.Table(

       column list

)

SELECT   

       column list

FROM [linked server].[Database].dbo.Table AS PROD WITH (NOLOCK)

LEFTOUTERJOIN [Database].dbo.Table AS CP

       ON PROD.PKID= CP.PKID

WHERE PROD.FilterByCol = @FilterByColValue

       AND CP.PKID ISNULL


TIA,
Dave


Viewing all articles
Browse latest Browse all 15889

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>