title: How to prevent a row from being deleted based on the value of a column
body: <p>Suppose we have a table called <code>StudentAccount</code> with columns <code>SID</code> (student Id) and <code>AmountOwing</code>.
  We cannot delete the account from the system unless the student owes nothing on their account. (That is <code>AmountOwing = $0.00</code>).</p>
  
  <p>For example the table could look like: </p>
  
  <pre><code>SID    | Amount Owing
  -------+--------------
  32415  | $30.00
  39872  | $0.00
  35135  | $3200.00
  </code></pre>
  
  <p>In this case, we can delete row 2 only.</p>
  
  <p>Is there a way to enforce this constraint on the table using valid MS SQL Server 2012 SQL syntax (so that an uneducated user won't accidentally delete a non-empty account)?</p>