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

Query over linked server responds with partial data when the spid on the remote server is killed

$
0
0

Local server is version 10.50.4000
Linked server is 9.0.5000

With the following stored procedure:
Create table #TMP
    (
        [ID] int NOT NULL,
        [SKU] [varchar](50) NOT NULL,
        ...
    )
    INSERT INTO #TMP
    SELECT
        [Siteid]
     ,[ITEM]
    
    FROM LinkedServer.db.dbo.v_ViewOnLinkedServer WITH (NOLOCK)
    
    PRINT 'Inserted'
    
    DELETE LocalTable
    WHERE SKU NOT IN (SELECT SKU FROM #TMP)

The spid on the remote server was killed and the query inserted into the temp table just a third of the records - causing the other 2 thirds to be deleted

What was expected:
The cross sever query should have been an Atomic operation - if part of it failed then all of it should have failed.

We ran many tests over and over (20 +) and got variable results - 

most times it retrieves thousands of rows then failed cleanly when the spid was killed.

however about 5% of the time  the query returned as if it had read all of its results and continued on with the next stamtet as if nothing happend


Viewing all articles
Browse latest Browse all 15889

Trending Articles



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