title: SQL Server - Simultaneous Inserts to the table from multiple clients - Check Limit and Block
body: <p>We are recently facing one issue with simultaneous inserts into one of our sal server tables  from multiple clients. I hope you guys can help us through.</p>
  
  <p>We are using stored procedure to do the transactions.  In that stored procedure, for each transaction, we calculate total sales so far. If the total sales is less than the set limit,
  then the transaction will be allowed. Otherwise, the transaction will be denied.</p>
  
  <p>it works fine most of times. But, sometimes when multiple clients trying to do the transaction exactly at the same time, the limit check is failing as both the transactions get done. </p>
  
  <p>Can you guys suggest how we can effectively enforce the limit all the time? Is there any better way to do that?</p>
  
  <p>Thanks!</p>