title: Identify the reason of deadlock
body: <p>I have 2+ concurrent processes. Inside them there is an iteration that perform repetitive validate (select) + save (insert) operations. Here is the sql-server-profiler info on the deadlock:   </p>
  
  <pre><code>&lt;deadlock-list&gt;
       &lt;deadlock victim="process8e09048"&gt;
        &lt;process-list&gt;
         &lt;process id="process8e09048" taskpriority="0" logused="1088" waitresource="PAGE: 29:1:376823" waittime="920" ownerId="1276429306" transactionname="user_transaction" lasttranstarted="2012-09-26T20:59:44.367" XDES="0x3077833c0" lockMode="S" schedulerid="1" kpid="4872" status="suspended" spid="79" sbid="0" ecid="0" priority="0" trancount="1" lastbatchstarted="2012-09-26T20:59:44.427" lastbatchcompleted="2012-09-26T20:59:44.427" clientapp=".Net SqlClient Data Provider" hostname="PORTAL" hostpid="5348" loginname="IIS APPPOOL\ASP.NET v4.0 Classic" isolationlevel="read committed (2)" xactid="1276429306" currentdb="29" lockTimeout="4294967295" clientoption1="671088672" clientoption2="128056"&gt;
          &lt;executionStack&gt;
           &lt;frame procname="adhoc" line="1" stmtstart="282" sqlhandle="0x02000000b79df8046665e3984d6dc129fec20a3029fce9bc"&gt;
      SELECT id FROM [WP_CashCenter_StockTransactionLine] WHERE StockTransaction_id=@StockTransaction_id and Direction=@Direction and IsVerified=@IsVerified and QualificationType=@QualificationType and id &amp;lt;&amp;gt; @id and Product_id is null and Material_id=@Material_id and StockContainer_id is null and StockLocation_id=@StockLocation_id     &lt;/frame&gt;
           &lt;frame procname="unknown" line="1" sqlhandle="0x000000000000000000000000000000000000000000000000"&gt;
      unknown     &lt;/frame&gt;
          &lt;/executionStack&gt;
          &lt;inputbuf&gt;
      (@id bigint,@StockTransaction_id bigint,@Direction int,@IsVerified bit,@QualificationType int,@Material_id nvarchar(3),@StockLocation_id int)SELECT id FROM [WP_CashCenter_StockTransactionLine] WHERE StockTransaction_id=@StockTransaction_id and Direction=@Direction and IsVerified=@IsVerified and QualificationType=@QualificationType and id &amp;lt;&amp;gt; @id and Product_id is null and Material_id=@Material_id and StockContainer_id is null and StockLocation_id=@StockLocation_id    &lt;/inputbuf&gt;
         &lt;/process&gt;
         &lt;process id="process5c13948" taskpriority="0" logused="2636" waitresource="PAGE: 29:1:376823" waittime="920" ownerId="1276429252" transactionname="user_transaction" lasttranstarted="2012-09-26T20:59:44.337" XDES="0x222e64e80" lockMode="S" schedulerid="6" kpid="2956" status="suspended" spid="70" sbid="0" ecid="0" priority="0" trancount="1" lastbatchstarted="2012-09-26T20:59:44.427" lastbatchcompleted="2012-09-26T20:59:44.427" clientapp=".Net SqlClient Data Provider" hostname="PORTAL" hostpid="5348" loginname="IIS APPPOOL\ASP.NET v4.0 Classic" isolationlevel="read committed (2)" xactid="1276429252" currentdb="29" lockTimeout="4294967295" clientoption1="671088672" clientoption2="128056"&gt;
          &lt;executionStack&gt;
           &lt;frame procname="adhoc" line="1" stmtstart="238" sqlhandle="0x02000000d77dd1038a9b7f6d7158436117c042e42767242d"&gt;
      SELECT id FROM [WP_CashCenter_StockTransactionLine] WHERE StockTransaction_id=@StockTransaction_id and Direction=@Direction and IsVerified=@IsVerified and QualificationType=@QualificationType and id &amp;lt;&amp;gt; @id and Product_id is null and Material_id=@Material_id and StockContainer_id is null and StockLocation_id is null     &lt;/frame&gt;
           &lt;frame procname="unknown" line="1" sqlhandle="0x000000000000000000000000000000000000000000000000"&gt;
      unknown     &lt;/frame&gt;
          &lt;/executionStack&gt;
          &lt;inputbuf&gt;
      (@id bigint,@StockTransaction_id bigint,@Direction int,@IsVerified bit,@QualificationType int,@Material_id nvarchar(3))SELECT id FROM [WP_CashCenter_StockTransactionLine] WHERE StockTransaction_id=@StockTransaction_id and Direction=@Direction and IsVerified=@IsVerified and QualificationType=@QualificationType and id &amp;lt;&amp;gt; @id and Product_id is null and Material_id=@Material_id and StockContainer_id is null and StockLocation_id is null    &lt;/inputbuf&gt;
         &lt;/process&gt;
        &lt;/process-list&gt;
        &lt;resource-list&gt;
         &lt;pagelock fileid="1" pageid="376823" dbid="29" objectname="Edsson_WebPortal_v5.01.dbo.WP_CashCenter_StockTransactionLine" id="lock9302c80" mode="IX" associatedObjectId="72057594148028416"&gt;
          &lt;owner-list&gt;
           &lt;owner id="process5c13948" mode="IX"/&gt;
          &lt;/owner-list&gt;
          &lt;waiter-list&gt;
           &lt;waiter id="process8e09048" mode="S" requestType="convert"/&gt;
          &lt;/waiter-list&gt;
         &lt;/pagelock&gt;
         &lt;pagelock fileid="1" pageid="376823" dbid="29" objectname="Edsson_WebPortal_v5.01.dbo.WP_CashCenter_StockTransactionLine" id="lock9302c80" mode="IX" associatedObjectId="72057594148028416"&gt;
          &lt;owner-list&gt;
           &lt;owner id="process8e09048" mode="IX"/&gt;
          &lt;/owner-list&gt;
          &lt;waiter-list&gt;
           &lt;waiter id="process5c13948" mode="S" requestType="convert"/&gt;
          &lt;/waiter-list&gt;
         &lt;/pagelock&gt;
        &lt;/resource-list&gt;
       &lt;/deadlock&gt;
      &lt;/deadlock-list&gt;
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/Zukoe.jpg" alt="enter image description here"></p>
  
  <p>The statements are selects with conditions. The where clause of these selects only uses columns that are included to non-clustered index. Execution plan:
  <img src="https://i.stack.imgur.com/j7noB.jpg" alt="enter image description here"></p>