title: Why SQL transaction not getting Rollback
body: <p>I'm trying to rollback a transaction if the sum of enrollment for certain classes is over 50. For some reason, even though my if statement equates to true (the sum of the courses is 60) this still ends up deleting the courses. </p>
  
  <p>Any ideas?</p>
  
  <pre><code>BEGIN TRANSACTION T1
  DELETE FROM Course WHERE Term = 'C'
      IF (SELECT SUM(Enrollment) FROM Course WHERE Term = 'C') &gt; 50
      BEGIN;
          THROW 50002, 'Total Enrollment Greater Than 50... Rolling Back Transaction...', 1;
      ROLLBACK TRANSACTION T1;
      END;
  COMMIT TRANSACTION T1
  </code></pre>