title: Transaction was deadlocked on lock resources with another process and has been chosen as the deadlock
body: <p>I have the following procedure to update my booking and other related tables.</p>
  
  <p>But we often get the error</p>
  
  <p><code>Transaction (Process ID 51) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.</code></p>
  
  <pre><code>CREATE PROCEDURE [dbo].[UpdateBookingDetails] (
       @ParmsList
      )
  AS
  BEGIN
      SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
      SET NOCOUNT ON
  
      BEGIN TRY
          BEGIN TRANSACTION UPDATEBOOKINGTRAN
  
  
              UPDATE Booking          
  
              SET @RecordsAffected = @@ROWCOUNT   
  
              INSERT INTO Payment 
  
              DELETE  FROM AdditionalBookingCategories
  
              INSERT AdditionalBookingCategories 
  
              DELETE FROM BookingAssistants
  
              INSERT INTO BookingAssistants 
  
              DELETE FROM BookingResource
  
              INSERT BookingResource 
  
  
          COMMIT TRANSACTION UPDATEBOOKINGTRAN
      END TRY
  
      BEGIN CATCH
          IF (@@TRANCOUNT &gt; 0)
          BEGIN
              ROLLBACK TRANSACTION UPDATEBOOKINGTRAN
  
              PRINT 'Error detected, all changes reversed'
          END
  
          -- ERROR HANDLING - Grab Error code and throw  
          DECLARE @ErrorMessage NVARCHAR(4000)
              ,@ErrorProc NVARCHAR(126)
              ,@ErrorLineNo INT;
  
          SELECT @ErrorLineNo = ERROR_LINE()
              ,@ErrorMessage = ERROR_MESSAGE()
              ,@ErrorProc = ERROR_PROCEDURE();
  
          RAISERROR (
                  'Error %s occurred in %s. Line  %d'
                  ,16
                  ,1
                  ,@ErrorMessage
                  ,@ErrorProc
                  ,@ErrorLineNo
                  )
          WITH SETERROR;
      END CATCH
  END
  </code></pre>
  
  <p>I couldn't find out what is the problem with my procedure. It looks ok, but how the deadlock appears? Is anything I am missing in my procedure to handle the deadlock?</p>
  
  <p>It happens rarely but atleast 5 times a day. I couldn't replicate as it requires simultaneous update.</p>