title: Parallel merge strategy without deadlock
body: <p>Using SQL Server 2016, I wish to merge data from a <code>SourceTable</code> to a <code>DestinationTable</code> with a simple procedure containing a simple insert/update/delete on the same table.</p>
  
  <p>The <code>SourceTable</code> is filled by several different applications, and they call the <code>MergeOrders</code> stored procedure to merge their uploaded rows from <code>SourceTable</code> into <code>DestinationTable</code>.</p>
  
  <p>There can be several instances of <code>MergeOrders</code> stored procedure running in parallel.</p>
  
  <p>I get a lot of lock, but that's normal, the issue is that sometimes I get "RowGroup deadlocks", which I cannot afford.</p>
  
  <p>What is the best way to execute such merge operation in this parallel environment.</p>
  
  <p>I am thinking about TABLOCK or SERIALIZABLE hints, or maybe application locks to serialize the access, but interested if there is better way.</p>