title: Queue up requests to a sql server stored procedure
body: <p>I am working with a stored procedure that:</p>
  
  <ol>
  <li><p>determines the number of rows in the table where the chosenBy column is null</p></li>
  <li><p>picks one of these rows at random</p></li>
  <li><p>updates the chosenBy column of this row</p></li>
  <li><p>returns the row to the client</p></li>
  </ol>
  
  <p>How do I prevent clients from choosing the same row in situations where they choose at exactly the same time?</p>
  
  <p>I have tried various table hints and isolation levels but just get deadlock exceptions at the client. I just want the second call to wait for the fraction of a second until the first call is completed.</p>