MERGE statement: skipping locked records

SQL Server database administration questions.

MERGE statement: skipping locked records

Postby alex » Tue Sep 11, 2012 1:27 am

HI,

I was hoping if someone could confirm if it was possible to skip locked records in a MERGE statement and output the list of skipped records.


Through the documentation, internet posts and testing, I believe it is NOT possible.
MERGE acts like a single atomic DML statement, and therefore cannot avoid locked records.

I can use the READPAST hint, which will skip the row-locked records. However, it could actually insert duplicate keys in certain cases (as it is ignoring records, i would guess), which would not be acceptable.


Thanks!
alex
 
Posts: 6
Joined: Tue Jul 14, 2009 9:43 am

Invitations sent: 0
Successful invitations: 0

Re: MERGE statement: skipping locked records

Postby marian » Tue Sep 11, 2012 1:28 am

It also will not work for you because it will not "record" the skipped records.
marian
Site Admin
 
Posts: 16
Joined: Tue Jul 14, 2009 9:13 am

Invitations sent: 15
Successful invitations: 2


Return to SQL Server Administration

Who is online

Users browsing this forum: No registered users and 1 guest

cron